Decompiled source of Tesla Trooper v2.2.3

plugins/TeslaTrooperMod.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Aetherium.Items;
using AncientScepter;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BetterUI;
using EmotesAPI;
using EntityStates;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Huntress;
using EntityStates.Toolbot;
using EntityStates.Treebot.Weapon;
using EntityStates.VagrantMonster;
using HG;
using HG.BlendableTypes;
using JetBrains.Annotations;
using KinematicCharacterController;
using ModdedEntityStates;
using ModdedEntityStates.BaseStates;
using ModdedEntityStates.Desolator;
using ModdedEntityStates.TeslaTrooper;
using ModdedEntityStates.TeslaTrooper.Tower;
using Modules;
using Modules.Achievements;
using Modules.Characters;
using Modules.Survivors;
using On.EntityStates.Commando.CommandoWeapon;
using On.RoR2;
using On.RoR2.CharacterAI;
using On.RoR2.Orbs;
using R2API;
using R2API.Utils;
using RTAutoSprintEx;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Orbs;
using RoR2.Projectile;
using RoR2.Skills;
using SkillsPlusPlus;
using SkillsPlusPlus.Modifiers;
using TILER2;
using TeslaTrooper;
using ThinkInvisible.TinkersSatchel;
using ThreeEyedGames;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using VRAPI;
using Zio.FileSystems;

[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyTitle("TeslaTrooperMod")]
[assembly: AssemblyProduct("TeslaTrooperMod")]
[assembly: AssemblyCompany("TeslaTrooperMod")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class DesolatorAuraController : NetworkBehaviour
{
	[SyncVar]
	public GameObject Owner;

	private ParticleSystem[] auraParticles;

	private bool _active;

	private BuffWard buffward;

	private CharacterBody cachedOwnerBody;

	private float _scaleVelocity;

	private float _localScale;

	private NetworkInstanceId ___OwnerNetId;

	private static int kRpcRpcSetOwner;

	private float currentRadius => _active ? RadiationAura.Radius : 0f;

	public GameObject NetworkOwner
	{
		get
		{
			return Owner;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVarGameObject(value, ref Owner, 1u, ref ___OwnerNetId);
		}
	}

	public void Awake()
	{
		buffward = ((Component)this).GetComponent<BuffWard>();
		auraParticles = ((Component)this).GetComponentsInChildren<ParticleSystem>(true);
		Activate(shouldActivate: false);
	}

	[ClientRpc]
	public void RpcSetOwner(GameObject owner_)
	{
		NetworkOwner = owner_;
		cachedOwnerBody = Owner.GetComponent<CharacterBody>();
	}

	public void Activate(bool shouldActivate)
	{
		_active = shouldActivate;
		((Behaviour)buffward).enabled = shouldActivate;
		buffward.radius = currentRadius;
		if (shouldActivate)
		{
			OnIciclesActivated();
		}
		else
		{
			OnIciclesDeactivated();
		}
	}

	private void Update()
	{
		//IL_001d: 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_006c: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)cachedOwnerBody))
		{
			((Component)this).transform.position = cachedOwnerBody.corePosition;
			_localScale = Mathf.SmoothDamp(((Component)this).transform.localScale.x, currentRadius, ref _scaleVelocity, 0.5f);
			((Component)this).transform.localScale = new Vector3(_localScale, _localScale, _localScale);
		}
	}

	private void OnIciclesActivated()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < auraParticles.Length; i++)
		{
			MainModule main = auraParticles[i].main;
			((MainModule)(ref main)).loop = true;
			auraParticles[i].Play();
		}
	}

	private void OnIciclesDeactivated()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < auraParticles.Length; i++)
		{
			MainModule main = auraParticles[i].main;
			((MainModule)(ref main)).loop = false;
		}
	}

	private void UNetVersion()
	{
	}

	protected static void InvokeRpcRpcSetOwner(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"RPC RpcSetOwner called on server.");
		}
		else
		{
			((DesolatorAuraController)(object)obj).RpcSetOwner(reader.ReadGameObject());
		}
	}

	public void CallRpcSetOwner(GameObject owner_)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"RPC Function RpcSetOwner called on client.");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kRpcRpcSetOwner);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(owner_);
		((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcSetOwner");
	}

	static DesolatorAuraController()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		kRpcRpcSetOwner = -330604917;
		NetworkBehaviour.RegisterRpcDelegate(typeof(DesolatorAuraController), kRpcRpcSetOwner, new CmdDelegate(InvokeRpcRpcSetOwner));
		NetworkCRC.RegisterBehaviour("DesolatorAuraController", 0);
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		if (forceAll)
		{
			writer.Write(Owner);
			return true;
		}
		bool flag = false;
		if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(Owner);
		}
		if (!flag)
		{
			writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
		}
		return flag;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		//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)
		if (initialState)
		{
			___OwnerNetId = reader.ReadNetworkId();
			return;
		}
		int num = (int)reader.ReadPackedUInt32();
		if (((uint)num & (true ? 1u : 0u)) != 0)
		{
			Owner = reader.ReadGameObject();
		}
	}

	public override void PreStartClient()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		if (!((NetworkInstanceId)(ref ___OwnerNetId)).IsEmpty())
		{
			NetworkOwner = ClientScene.FindLocalObject(___OwnerNetId);
		}
	}
}
public class DesolatorAuraHolder : NetworkBehaviour
{
	[SyncVar]
	private GameObject _spawnedAuraObject = null;

	private DesolatorAuraController _spawnedAura = null;

	private NetworkInstanceId ____spawnedAuraObjectNetId;

	public GameObject Network_spawnedAuraObject
	{
		get
		{
			return _spawnedAuraObject;
		}
		[param: In]
		set
		{
			((NetworkBehaviour)this).SetSyncVarGameObject(value, ref _spawnedAuraObject, 1u, ref ____spawnedAuraObjectNetId);
		}
	}

	private void Awake()
	{
		SpawnAura();
	}

	public void SpawnAura()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		if (NetworkServer.active)
		{
			GameObject val = Object.Instantiate<GameObject>(Assets.DesolatorAuraPrefab, ((Component)this).transform.position, Quaternion.identity);
			NetworkServer.Spawn(val);
			Network_spawnedAuraObject = val;
		}
	}

	public void ActivateAura()
	{
		if ((Object)(object)_spawnedAura == (Object)null)
		{
			_spawnedAura = _spawnedAuraObject.GetComponent<DesolatorAuraController>();
			if (NetworkServer.active)
			{
				_spawnedAura.CallRpcSetOwner(((Component)this).gameObject);
			}
		}
		if ((Object)(object)_spawnedAura == (Object)null)
		{
			Helpers.LogWarning("fuck2");
		}
		_spawnedAura?.Activate(shouldActivate: true);
	}

	public void DeactivateAura()
	{
		_spawnedAura?.Activate(shouldActivate: false);
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)_spawnedAuraObject))
		{
			NetworkServer.Destroy(_spawnedAuraObject);
		}
	}

	private void UNetVersion()
	{
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		if (forceAll)
		{
			writer.Write(_spawnedAuraObject);
			return true;
		}
		bool flag = false;
		if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
		{
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
				flag = true;
			}
			writer.Write(_spawnedAuraObject);
		}
		if (!flag)
		{
			writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
		}
		return flag;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
		//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)
		if (initialState)
		{
			____spawnedAuraObjectNetId = reader.ReadNetworkId();
			return;
		}
		int num = (int)reader.ReadPackedUInt32();
		if (((uint)num & (true ? 1u : 0u)) != 0)
		{
			_spawnedAuraObject = reader.ReadGameObject();
		}
	}

	public override void PreStartClient()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		if (!((NetworkInstanceId)(ref ____spawnedAuraObjectNetId)).IsEmpty())
		{
			Network_spawnedAuraObject = ClientScene.FindLocalObject(____spawnedAuraObjectNetId);
		}
	}
}
public class DesolatorMenu : MonoBehaviour
{
	[SerializeField]
	private GameObject lightPrefab;

	[SerializeField]
	private Transform deployPoint;

	private void Start()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(lightPrefab, deployPoint, false);
		val.transform.localPosition = Vector3.zero;
		val.transform.parent = null;
		Util.PlaySound("Play_Desolator_Deploy", ((Component)this).gameObject);
		if (Config.VoiceInLobby.Value)
		{
			Util.PlaySound("Play_Desolator_Voiceline", ((Component)this).gameObject);
		}
	}
}
public class DesolatorWeaponComponent : MonoBehaviour
{
	private CharacterBody characterBody;

	private Animator animator;

	private void Awake()
	{
		characterBody = ((Component)this).GetComponent<CharacterBody>();
		animator = ((Component)characterBody.modelLocator.modelTransform).GetComponent<Animator>();
		characterBody.onInventoryChanged += CharacterBody_onInventoryChanged;
	}

	private void CharacterBody_onInventoryChanged()
	{
		bool flag = characterBody.inventory.GetItemCount(Items.ChainLightning) > 0 || characterBody.inventory.GetItemCount(Items.ChainLightningVoid) > 0 || characterBody.inventory.GetItemCount(Items.ArmorReductionOnHit) > 0 || characterBody.inventory.GetItemCount(Items.MoveSpeedOnKill) > 0;
		animator.SetBool("LeftHandClosed", flag);
	}
}
public class FuckinMaterialComponent : MonoBehaviour
{
	private Renderer[] rends;

	public float strenght;

	public float exponent;

	private MaterialPropertyBlock matblock;

	private void Awake()
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		matblock = new MaterialPropertyBlock();
		rends = ((Component)this).GetComponentsInChildren<Renderer>();
	}

	private void Update()
	{
		if (Input.GetKey((KeyCode)103))
		{
			for (int i = 0; i < rends.Length; i++)
			{
				Renderer val = rends[i];
				val.GetPropertyBlock(matblock);
				matblock.SetFloat("_SpecularStrength", strenght);
				matblock.SetFloat("_SpecularExponent", exponent);
				val.SetPropertyBlock(matblock);
			}
		}
	}
}
public class HammerReparenter : MonoBehaviour
{
	[SerializeField]
	private Transform hammer;

	[SerializeField]
	private Transform hand;

	[SerializeField]
	private Transform hip;

	public void Reparent(int parent)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		hammer.SetParent((parent == 0) ? hand : hip);
		hammer.localPosition = Vector3.zero;
		hammer.localRotation = Quaternion.identity;
	}
}
public class KeepHeadInPositionComponent : MonoBehaviour
{
	[SerializeField]
	private Transform reference;

	private void LateUpdate()
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.localEulerAngles = new Vector3(0f, reference.localEulerAngles.y, 0f);
	}
}
[RequireComponent(typeof(Light))]
public class LightRadiusScale : MonoBehaviour
{
	[SerializeField]
	private Light light;

	[SerializeField]
	public float sizeMultiplier;

	private void LateUpdate()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		light.range = ((Component)this).transform.lossyScale.x * 2f * sizeMultiplier;
	}
}
public class nopejs : MonoBehaviour
{
	[Range(-1f, 1f)]
	[SerializeField]
	private float x;

	[Range(-1f, 1f)]
	[SerializeField]
	private float y = 1f;

	[SerializeField]
	[Range(-1f, 1f)]
	private float z;

	[SerializeField]
	private float mult = 10f;

	private void Update()
	{
		//IL_0019: 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_002e: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.Rotate(new Vector3(x, y, z) * mult * Time.deltaTime);
	}
}
[Serializable]
public class Recolor
{
	public string recolorName;

	public Color[] colors = (Color[])(object)new Color[1] { Color.red };
}
[Serializable]
public class RecolorGroup
{
	[SerializeField]
	private Renderer[] renderers;

	[SerializeField]
	private bool emission;

	private MaterialPropertyBlock[] _matProperties;

	public void fillPropertyBlocks()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Expected O, but got Unknown
		_matProperties = (MaterialPropertyBlock[])(object)new MaterialPropertyBlock[renderers.Length];
		for (int i = 0; i < renderers.Length; i++)
		{
			_matProperties[i] = new MaterialPropertyBlock();
			renderers[i].GetPropertyBlock(_matProperties[i]);
		}
	}

	public void setColors(Color color)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < _matProperties.Length; i++)
		{
			_matProperties[i].SetColor("_Color", color);
			if (emission)
			{
				_matProperties[i].SetColor("_EmColor", color);
			}
			renderers[i].SetPropertyBlock(_matProperties[i]);
		}
	}
}
public class SkinRecolorController : MonoBehaviour
{
	[SerializeField]
	private RecolorGroup[] recolorGroups;

	[Space]
	[SerializeField]
	private Recolor[] recolors;

	public Recolor[] Recolors => recolors;

	public int currentColor { get; private set; } = -1;


	private void Awake()
	{
		if (recolorGroups != null)
		{
			for (int i = 0; i < recolorGroups.Length; i++)
			{
				recolorGroups[i].fillPropertyBlocks();
			}
		}
	}

	public void SetRecolor(Color[] colors)
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < recolorGroups.Length; i++)
		{
			if (i < colors.Length)
			{
				recolorGroups[i].setColors(colors[i]);
			}
		}
	}

	public void SetRecolor(int i)
	{
		if (recolors[i].colors.Length < recolorGroups.Length)
		{
			Debug.LogError((object)"not enough colors for this recolor");
		}
		SetRecolor(recolors[i].colors);
		currentColor = i;
	}

	public void SetRecolor(string name)
	{
		for (int i = 0; i < recolors.Length; i++)
		{
			if (recolors[i].recolorName == name)
			{
				SetRecolor(i);
				break;
			}
		}
	}
}
public class SpawnProjectileOnAnimation : MonoBehaviour
{
	[SerializeField]
	private CharacterModel characterModel;

	public void SpawnProjectile()
	{
		EntityStateMachine.FindByCustomName(((Component)characterModel.body).gameObject, "Weapon").SetNextState((EntityState)(object)new EmoteRadiationProjectile());
	}
}
public class ZappableTower : MonoBehaviour
{
	public HurtBox MainHurtbox;
}
public interface IReflectionBarrier
{
	void StoreDamage(DamageInfo damageInfo, float damageStored);
}
public class TeslaMenuSound : MonoBehaviour
{
	private void OnEnable()
	{
		Util.PlaySound("Play_Tesla_lobby", ((Component)this).gameObject);
		if (Config.VoiceInLobby.Value)
		{
			Util.PlaySound("Play_VoiceLine", ((Component)this).gameObject);
		}
	}
}
public class TeslaTowerControllerController : MonoBehaviour
{
	public static float NearTowerRange = 60f;

	private List<GameObject> teslaTowers = new List<GameObject>();

	private List<GameObject> otherCommandables = new List<GameObject>();

	public bool coilReady
	{
		get
		{
			List<GameObject> nearbyTowers = GetNearbyTowers();
			for (int i = 0; i < nearbyTowers.Count; i++)
			{
				if (nearbyTowers[i].GetComponent<SkillLocator>().FindSkill("Secondary").IsReady())
				{
					return true;
				}
			}
			return false;
		}
	}

	public GameObject GetNearestTower()
	{
		//IL_0037: 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)
		float num = NearTowerRange * 2f;
		GameObject result = null;
		for (int i = 0; i < teslaTowers.Count; i++)
		{
			GameObject val = teslaTowers[i];
			if (!((Object)(object)val == (Object)null))
			{
				float num2 = Vector3.Distance(val.transform.position, ((Component)this).transform.position);
				if (num2 < NearTowerRange && num2 < num)
				{
					num = num2;
					result = val;
				}
			}
		}
		return result;
	}

	public void commandPrismTowers(HurtBox target)
	{
	}

	public void commandTowers(HurtBox target)
	{
		if (!NetworkServer.active)
		{
			return;
		}
		List<GameObject> nearbyTowers = GetNearbyTowers();
		for (int i = 0; i < nearbyTowers.Count; i++)
		{
			GameObject val = nearbyTowers[i];
			if (!((Object)(object)val == (Object)null))
			{
				val.GetComponent<EntityStateMachine>().SetInterruptState((EntityState)(object)new TowerBigZap
				{
					lightningTarget = target
				}, (InterruptPriority)2);
			}
		}
		for (int j = 0; j < otherCommandables.Count; j++)
		{
			otherCommandables[j].GetComponent<EntityStateMachine>().SetInterruptState((EntityState)(object)new TowerZap
			{
				lightningTarget = target,
				zaps = 2
			}, (InterruptPriority)2);
		}
	}

	public void commandTowersGauntlet(HurtBox target)
	{
		if (!NetworkServer.active)
		{
			return;
		}
		List<GameObject> nearbyTowers = GetNearbyTowers();
		for (int i = 0; i < nearbyTowers.Count; i++)
		{
			GameObject val = nearbyTowers[i];
			if (!((Object)(object)val == (Object)null))
			{
				EntityStateMachine val2 = EntityStateMachine.FindByCustomName(val, "Weapon");
				if (!((Object)(object)val2 == (Object)null))
				{
					val2.SetInterruptState((EntityState)(object)new TowerBigZapGauntlet
					{
						lightningTarget = target
					}, (InterruptPriority)2);
				}
			}
		}
	}

	public int NearbyTowers()
	{
		return GetNearbyTowers().Count;
	}

	public List<GameObject> GetNearbyTowers(GameObject nearObject = null)
	{
		//IL_0042: 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)
		if ((Object)(object)nearObject == (Object)null)
		{
			nearObject = ((Component)this).gameObject;
		}
		List<GameObject> list = new List<GameObject>();
		for (int i = 0; i < teslaTowers.Count; i++)
		{
			GameObject val = teslaTowers[i];
			if (!((Object)(object)val == (Object)null))
			{
				float num = Vector3.Distance(val.transform.position, nearObject.transform.position);
				if (num < NearTowerRange)
				{
					list.Add(val);
				}
			}
		}
		return list;
	}

	public void addTower(GameObject towerBodyObject)
	{
		teslaTowers.Add(towerBodyObject);
		towerBodyObject.GetComponent<TowerOwnerTrackerComponent>().OwnerTrackerComponent = ((Component)this).GetComponent<TeslaTrackerComponentZap>();
		SkinRecolorController component = ((Component)((Component)this).gameObject.GetComponent<CharacterBody>().modelLocator.modelTransform).GetComponent<SkinRecolorController>();
		if (Object.op_Implicit((Object)(object)component) && component.Recolors != null)
		{
			SkinRecolorController component2 = ((Component)towerBodyObject.GetComponent<CharacterBody>().modelLocator.modelTransform).GetComponent<SkinRecolorController>();
			if (Object.op_Implicit((Object)(object)component2))
			{
				component2.SetRecolor(component.currentColor);
			}
		}
	}

	public void removeTower(GameObject towerObject)
	{
		teslaTowers.Remove(towerObject);
	}

	public void addNotTower(GameObject notTowerBodyObject)
	{
		otherCommandables.Add(notTowerBodyObject);
	}

	public void removeNotTower(GameObject notTowerBodyObject)
	{
		otherCommandables.Remove(notTowerBodyObject);
	}
}
public class TeslaVRComponent : MonoBehaviour
{
	private CharacterBody body;

	private void Awake()
	{
		body = ((Component)this).GetComponent<CharacterBody>();
	}

	private void Start()
	{
		onHandPairSet();
	}

	private void onHandPairSet()
	{
		if (!(body.baseNameToken != "HABIBI_TESLA_BODY_NAME"))
		{
			SkillLocator skillLocator = body.skillLocator;
			object obj;
			if (skillLocator == null)
			{
				obj = null;
			}
			else
			{
				GenericSkill obj2 = skillLocator.FindSkill("Recolor");
				obj = ((obj2 != null) ? obj2.skillDef : null);
			}
			SkillDef val = (SkillDef)obj;
			if (Object.op_Implicit((Object)(object)val))
			{
				((Component)MotionControls.dominantHand.transform).GetComponentInChildren<SkinRecolorController>().SetRecolor(val.skillName.ToLowerInvariant());
				((Component)MotionControls.nonDominantHand.transform).GetComponentInChildren<SkinRecolorController>().SetRecolor(val.skillName.ToLowerInvariant());
			}
			ChildLocator componentInChildren = ((Component)MotionControls.dominantHand.transform).GetComponentInChildren<ChildLocator>();
			switch (body.skinIndex)
			{
			default:
				componentInChildren.FindChildGameObject("MeshEmission").SetActive(false);
				break;
			case 1u:
				componentInChildren.FindChildGameObject("MeshEmission").SetActive(true);
				break;
			case 2u:
				((Component)MotionControls.nonDominantHand.transform).GetComponentInChildren<ChildLocator>().FindChildGameObject("MeshArmorColor").SetActive(false);
				componentInChildren.FindChildGameObject("MeshEmission").SetActive(true);
				break;
			case 3u:
				componentInChildren.FindChildGameObject("MeshEmission").SetActive(false);
				break;
			}
		}
	}
}
public class TeslaWeaponComponent : MonoBehaviour
{
	public bool hasTeslaCoil;

	public TeslaSkinDef teslaSkinDef;

	private CharacterBody characterBody;

	private Animator animator;

	private void Awake()
	{
		characterBody = ((Component)this).GetComponent<CharacterBody>();
		animator = ((Component)characterBody.modelLocator.modelTransform).GetComponent<Animator>();
		characterBody.onInventoryChanged += CharacterBody_onInventoryChanged;
	}

	private void Start()
	{
		try
		{
			teslaSkinDef = Skins.GetCurrentSkinDef(characterBody) as TeslaSkinDef;
		}
		catch
		{
			Object.Destroy((Object)(object)this);
		}
	}

	private void CharacterBody_onInventoryChanged()
	{
		hasTeslaCoil = characterBody.inventory.GetItemCount(Items.ShockNearby) > 0;
		bool flag = characterBody.inventory.GetItemCount(Items.ChainLightning) > 0 || characterBody.inventory.GetItemCount(Items.ChainLightningVoid) > 0 || characterBody.inventory.GetItemCount(Items.MoveSpeedOnKill) > 0;
		animator.SetBool("LeftHandClosed", flag);
	}
}
public class TeslaZapBarrierController : NetworkBehaviour, IReflectionBarrier
{
	public delegate void StoredDamageEvent(float damageStored);

	private bool _recordingDamage;

	private float _recordedDamage;

	public StoredDamageEvent OnStoredDamage;

	private static int kRpcRpcPlaySoundToClients;

	public void StoreDamage(DamageInfo damageInfo, float damageStored)
	{
		if (_recordingDamage)
		{
			OnStoredDamage?.Invoke(damageStored);
			_recordedDamage += damageStored;
			PlaySound(Mathf.Max(ShieldZapReleaseDamage.MaxDamageCoefficient, _recordedDamage / 5f));
		}
	}

	public void StartRecordingDamage()
	{
		_recordingDamage = true;
	}

	public float GetReflectedDamage()
	{
		float recordedDamage = _recordedDamage;
		_recordingDamage = false;
		_recordedDamage = 0f;
		return recordedDamage;
	}

	public void PlaySound(float pitch)
	{
		CallRpcPlaySoundToClients(pitch);
		PlaySoundInternal(pitch);
	}

	[ClientRpc]
	public void RpcPlaySoundToClients(float pitch)
	{
		PlaySoundInternal(pitch);
	}

	private void PlaySoundInternal(float pitch)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		uint num = Util.PlaySound("Play_Tesla_ShieldTakeDamage", ((Component)this).gameObject);
		AkSoundEngine.SetRTPCValueByPlayingID("Pitch_TeslaCharge", pitch, num);
	}

	private void UNetVersion()
	{
	}

	protected static void InvokeRpcRpcPlaySoundToClients(NetworkBehaviour obj, NetworkReader reader)
	{
		if (!NetworkClient.active)
		{
			Debug.LogError((object)"RPC RpcPlaySoundToClients called on server.");
		}
		else
		{
			((TeslaZapBarrierController)(object)obj).RpcPlaySoundToClients(reader.ReadSingle());
		}
	}

	public void CallRpcPlaySoundToClients(float pitch)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		if (!NetworkServer.active)
		{
			Debug.LogError((object)"RPC Function RpcPlaySoundToClients called on client.");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kRpcRpcPlaySoundToClients);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(pitch);
		((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcPlaySoundToClients");
	}

	static TeslaZapBarrierController()
	{
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Expected O, but got Unknown
		kRpcRpcPlaySoundToClients = -941864279;
		NetworkBehaviour.RegisterRpcDelegate(typeof(TeslaZapBarrierController), kRpcRpcPlaySoundToClients, new CmdDelegate(InvokeRpcRpcPlaySoundToClients));
		NetworkCRC.RegisterBehaviour("TeslaZapBarrierController", 0);
	}

	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		bool result = default(bool);
		return result;
	}

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
	}
}
public class TowerOwnerTrackerComponent : MonoBehaviour
{
	public TeslaTrackerComponentZap OwnerTrackerComponent;
}
public class TowerWeaponComponent : MonoBehaviour
{
	public bool hasTeslaCoil;

	public TowerSkinDef towerSkinDef;

	private CharacterBody characterBody;

	private void Awake()
	{
		characterBody = ((Component)this).GetComponent<CharacterBody>();
		characterBody.onInventoryChanged += CharacterBody_onInventoryChanged;
	}

	private void Start()
	{
		try
		{
			towerSkinDef = Skins.GetCurrentSkinDef(characterBody) as TowerSkinDef;
		}
		catch
		{
			Object.Destroy((Object)(object)this);
		}
	}

	private void CharacterBody_onInventoryChanged()
	{
		hasTeslaCoil = characterBody.inventory.GetItemCount(Items.ShockNearby) > 0;
	}
}
public class TeslaIndicatorView : MonoBehaviour
{
	public static Sprite[] rangeSprites = (Sprite[])(object)new Sprite[3]
	{
		Assets.LoadAsset<Sprite>("texIndicator1Close"),
		Assets.LoadAsset<Sprite>("texIndicator2Med"),
		Assets.LoadAsset<Sprite>("texIndicator3Far")
	};

	public static Sprite allySprite = Assets.LoadAsset<Sprite>("texIndicatorAlly");

	public static Sprite towerSprite = Assets.LoadAsset<Sprite>("texIndicatorTowerIcon");

	public static Color[] targetColors = (Color[])(object)new Color[3]
	{
		Color.cyan,
		Color.red,
		Color.green
	};

	public SpriteRenderer indicatorRenderer;

	public GameObject towerIndicator;

	public void SetColor(int currentTarget)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		indicatorRenderer.color = targetColors[currentTarget];
	}

	public void SetSpriteAlly()
	{
		indicatorRenderer.sprite = allySprite;
	}

	public void SetSpriteTower()
	{
		indicatorRenderer.sprite = towerSprite;
	}

	public void SetSpriteRange(int currentRange)
	{
		indicatorRenderer.sprite = rangeSprites[currentRange];
	}

	public void SetTowerIndicator(bool hasTower)
	{
		towerIndicator.SetActive(hasTower);
	}
}
[RequireComponent(typeof(InputBankTest))]
public class TeslaTrackerComponent : MonoBehaviour
{
	public delegate void OnSearchEvent();

	public OnSearchEvent SearchEvent;

	public static float maxTrackingDistance = 50f;

	public float trackingRadiusZap = 1f;

	public float trackingRadiusDash = 3f;

	public float trackerUpdateFrequency = 16f;

	public HurtBox trackingTargetZap;

	public HurtBox trackingTargetDash;

	public List<HealthComponent> dashCooldownTargets = new List<HealthComponent>();

	public List<float> dashCooldownTimers = new List<float>();

	private InputBankTest inputBank;

	private float trackerUpdateStopwatch;

	private void Start()
	{
		inputBank = ((Component)this).GetComponent<InputBankTest>();
	}

	private void FixedUpdate()
	{
		trackerUpdateStopwatch += Time.fixedDeltaTime;
		if (trackerUpdateStopwatch >= 1f / trackerUpdateFrequency)
		{
			OnSearch();
		}
		UpdateCooldownTimers();
	}

	private void UpdateCooldownTimers()
	{
		for (int num = dashCooldownTimers.Count - 1; num >= 0; num--)
		{
			if ((Object)(object)dashCooldownTargets[num] == (Object)null)
			{
				dashCooldownTargets.RemoveAt(num);
				dashCooldownTimers.RemoveAt(num);
			}
			else
			{
				dashCooldownTimers[num] -= Time.fixedDeltaTime;
				if (dashCooldownTimers[num] < 0f)
				{
					dashCooldownTargets.RemoveAt(num);
					dashCooldownTimers.RemoveAt(num);
				}
			}
		}
	}

	public void AddCooldownTarget(HealthComponent healthComponent)
	{
		if (!dashCooldownTargets.Contains(healthComponent))
		{
			dashCooldownTargets.Add(healthComponent);
			dashCooldownTimers.Add(4f);
		}
	}

	private void OnSearch()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		trackerUpdateStopwatch -= 1f / trackerUpdateFrequency;
		Ray aimRay = default(Ray);
		((Ray)(ref aimRay))..ctor(inputBank.aimOrigin, inputBank.aimDirection);
		FindTrackingTarget(aimRay);
		ZappableTower zappableTower = default(ZappableTower);
		if (Object.op_Implicit((Object)(object)trackingTargetZap) && Object.op_Implicit((Object)(object)trackingTargetZap.hurtBoxGroup) && ((Component)trackingTargetZap.hurtBoxGroup).TryGetComponent<ZappableTower>(ref zappableTower))
		{
			trackingTargetZap = zappableTower.MainHurtbox;
		}
		SearchEvent?.Invoke();
	}

	private bool FindTrackingTarget(Ray aimRay)
	{
		//IL_0002: 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_0033: Unknown result type (might be due to invalid IL or missing references)
		bool flag = SearchForTargetPoint(aimRay);
		if (!flag)
		{
			flag = SearchForTargetSphere(aimRay, trackingRadiusZap);
		}
		if (!Object.op_Implicit((Object)(object)trackingTargetDash))
		{
			SearchForDashTarget(aimRay, trackingRadiusDash);
		}
		return flag;
	}

	private bool SearchForTargetPoint(Ray aimRay)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		return CharacterRaycast(((Component)this).gameObject, aimRay, out trackingTargetZap, out trackingTargetDash, maxTrackingDistance, CommonMasks.bullet, (QueryTriggerInteraction)1);
	}

	private bool SearchForTargetSphere(Ray aimRay, float radius)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		return CharacterSpherecast(((Component)this).gameObject, aimRay, radius, out trackingTargetZap, out trackingTargetDash, maxTrackingDistance, CommonMasks.bullet, (QueryTriggerInteraction)1);
	}

	private bool SearchForDashTarget(Ray aimRay, float radius)
	{
		//IL_0008: 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)
		HurtBox zapHit;
		return CharacterSpherecast(((Component)this).gameObject, aimRay, radius, out zapHit, out trackingTargetDash, maxTrackingDistance, CommonMasks.bullet, (QueryTriggerInteraction)1);
	}

	public bool CharacterRaycast(GameObject bodyObject, Ray ray, out HurtBox zapHit, out HurtBox dashHit, float maxDistance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0004: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit[] hits = Physics.RaycastAll(ray, maxDistance, LayerMask.op_Implicit(layerMask), queryTriggerInteraction);
		return HandleCharacterPhysicsCastResults(bodyObject, ray, queryTriggerInteraction, hits, out zapHit, out dashHit);
	}

	public bool CharacterSpherecast(GameObject bodyObject, Ray ray, float radius, out HurtBox zapHit, out HurtBox dashHit, float maxDistance, LayerMask layerMask, QueryTriggerInteraction queryTriggerInteraction)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: 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)
		RaycastHit[] hits = Physics.SphereCastAll(ray, radius, maxDistance, LayerMask.op_Implicit(layerMask), queryTriggerInteraction);
		return HandleCharacterPhysicsCastResults(bodyObject, ray, queryTriggerInteraction, hits, out zapHit, out dashHit);
	}

	private bool HandleCharacterPhysicsCastResults(GameObject bodyObject, Ray ray, QueryTriggerInteraction queryTriggerInteraction, RaycastHit[] hits, out HurtBox zapHit, out HurtBox dashHit)
	{
		//IL_00c4: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		zapHit = null;
		dashHit = null;
		float num = float.PositiveInfinity;
		float num2 = float.PositiveInfinity;
		for (int i = 0; i < hits.Length; i++)
		{
			if ((Object)(object)((RaycastHit)(ref hits[i])).collider == (Object)null)
			{
				continue;
			}
			HurtBox component = ((Component)((RaycastHit)(ref hits[i])).collider).GetComponent<HurtBox>();
			if ((Object)(object)component == (Object)null || (Object)(object)component.healthComponent == (Object)null || (Object)(object)component.hurtBoxGroup == (Object)null || ((!Object.op_Implicit((Object)(object)component.hurtBoxGroup) || !Object.op_Implicit((Object)(object)((Component)component.hurtBoxGroup).GetComponent<ZappableTower>())) && Physics.Linecast(((RaycastHit)(ref hits[i])).point, ((Ray)(ref ray)).origin, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), queryTriggerInteraction)))
			{
				continue;
			}
			float distance = ((RaycastHit)(ref hits[i])).distance;
			if (!(distance < num) && !(distance < num2))
			{
				continue;
			}
			HealthComponent healthComponent = component.healthComponent;
			if (!Object.op_Implicit((Object)(object)healthComponent) || !((Object)(object)((Component)healthComponent).gameObject == (Object)(object)bodyObject))
			{
				if (distance < num2)
				{
					zapHit = component;
					num2 = distance;
				}
				if (distance < num && !dashCooldownTargets.Contains(component.healthComponent))
				{
					dashHit = component;
					num = distance;
				}
			}
		}
		if ((Object)(object)zapHit == (Object)null && (Object)(object)dashHit == (Object)null)
		{
			return false;
		}
		return true;
	}
}
[RequireComponent(typeof(CharacterBody))]
[RequireComponent(typeof(TeslaTrackerComponent))]
[RequireComponent(typeof(TeamComponent))]
public class TeslaTrackerComponentDash : MonoBehaviour
{
	public class TeslaDashIndicator : Indicator
	{
		public TeslaDashIndicator(GameObject owner, GameObject visualizerPrefab)
			: base(owner, visualizerPrefab)
		{
		}
	}

	private TeslaDashIndicator indicator;

	private TeslaTrackerComponent teslaTrackerComponent;

	private CharacterBody characterBody;

	private TeamComponent teamComponent;

	private HurtBox _trackingTarget;

	private bool _targetingAlly;

	private bool _isDashing;

	private bool _isReady;

	private void Awake()
	{
		indicator = new TeslaDashIndicator(((Component)this).gameObject, Assets.TeslaIndicatorPrefabDash);
	}

	private void Start()
	{
		teslaTrackerComponent = ((Component)this).GetComponent<TeslaTrackerComponent>();
		characterBody = ((Component)this).GetComponent<CharacterBody>();
		teamComponent = ((Component)this).GetComponent<TeamComponent>();
		TeslaTrackerComponent obj = teslaTrackerComponent;
		obj.SearchEvent = (TeslaTrackerComponent.OnSearchEvent)Delegate.Combine(obj.SearchEvent, new TeslaTrackerComponent.OnSearchEvent(OnSearch));
		characterBody.skillLocator.utility.onSkillChanged += Utility_onSkillChanged;
		Utility_onSkillChanged(characterBody.skillLocator.utility);
	}

	private void OnDestroy()
	{
		TeslaTrackerComponent obj = teslaTrackerComponent;
		obj.SearchEvent = (TeslaTrackerComponent.OnSearchEvent)Delegate.Remove(obj.SearchEvent, new TeslaTrackerComponent.OnSearchEvent(OnSearch));
	}

	private void Utility_onSkillChanged(GenericSkill genericSkill)
	{
		_isDashing = genericSkill.skillDef.skillNameToken == "HABIBI_TESLA_BODY_UTILITY_BLINK_NAME";
	}

	private void FixedUpdate()
	{
		((Indicator)indicator).active = _isDashing && _isReady;
	}

	public HurtBox GetTrackingTarget()
	{
		return _trackingTarget;
	}

	public bool GetIsTargetingTeammate()
	{
		return _targetingAlly;
	}

	public void SetIsReady(bool ready)
	{
		_isReady = ready;
	}

	private void OnSearch()
	{
		_trackingTarget = teslaTrackerComponent.trackingTargetDash;
		setIsTargetingTeammate();
		((Indicator)indicator).targetTransform = (Object.op_Implicit((Object)(object)_trackingTarget) ? ((Component)_trackingTarget).transform : null);
	}

	private void setIsTargetingTeammate()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		bool targetingAlly = false;
		if (Object.op_Implicit((Object)(object)_trackingTarget))
		{
			targetingAlly = !FriendlyFireManager.ShouldDirectHitProceed(_trackingTarget.healthComponent, teamComponent.teamIndex);
		}
		_targetingAlly = targetingAlly;
	}
}
[RequireComponent(typeof(TeamComponent))]
[RequireComponent(typeof(CharacterBody))]
[RequireComponent(typeof(TeslaTrackerComponent))]
public class TeslaTrackerComponentZap : MonoBehaviour
{
	public enum RangeTier
	{
		CLOSEST,
		MIDDLE,
		FURTHEST
	}

	public enum TargetType
	{
		DEFAULT,
		EMPOWERED,
		ALLY
	}

	public class TeslaZapIndicator : Indicator
	{
		public RangeTier currentRange = RangeTier.FURTHEST;

		public bool empowered;

		public bool targetingAlly;

		public bool towerIsTargeting;

		public TeslaZapIndicator(GameObject owner, GameObject visualizerPrefab)
			: base(owner, visualizerPrefab)
		{
		}

		public override void UpdateVisualizer()
		{
			((Indicator)this).UpdateVisualizer();
			if (Object.op_Implicit((Object)(object)((Indicator)this).visualizerTransform))
			{
				TeslaIndicatorView component = ((Component)((Indicator)this).visualizerTransform).GetComponent<TeslaIndicatorView>();
				TargetType targetType = TargetType.DEFAULT;
				if (empowered)
				{
					targetType = TargetType.EMPOWERED;
				}
				else if (targetingAlly)
				{
					targetType = TargetType.ALLY;
				}
				component.SetColor((int)targetType);
				switch (targetType)
				{
				default:
					component.SetSpriteRange((int)currentRange);
					break;
				case TargetType.EMPOWERED:
					component.SetSpriteTower();
					break;
				case TargetType.ALLY:
					component.SetSpriteAlly();
					break;
				}
				component.SetTowerIndicator(!targetingAlly && towerIsTargeting);
			}
		}
	}

	public static float nearTrackingDistance = 16f;

	public static float mediumTrackingDistance = 28f;

	private TeslaTrackerComponent teslaTrackerComponent;

	private CharacterBody characterBody;

	private TeamComponent teamComponent;

	private TeslaTowerControllerController towerControllerComponent;

	private TeslaZapIndicator indicator;

	private HurtBox _trackingTarget;

	private HealthComponent _towerTargetHealthComponent;

	private bool _targetingAlly;

	private bool _hasTowerNear;

	private bool _empowered;

	private bool _isMelee;

	private void Awake()
	{
		indicator = new TeslaZapIndicator(((Component)this).gameObject, Assets.TeslaIndicatorPrefab);
		towerControllerComponent = ((Component)this).GetComponent<TeslaTowerControllerController>();
	}

	private void Start()
	{
		teslaTrackerComponent = ((Component)this).GetComponent<TeslaTrackerComponent>();
		characterBody = ((Component)this).GetComponent<CharacterBody>();
		teamComponent = ((Component)this).GetComponent<TeamComponent>();
		TeslaTrackerComponent obj = teslaTrackerComponent;
		obj.SearchEvent = (TeslaTrackerComponent.OnSearchEvent)Delegate.Combine(obj.SearchEvent, new TeslaTrackerComponent.OnSearchEvent(OnSearch));
		characterBody.skillLocator.primary.onSkillChanged += Primary_onSkillChanged;
		Primary_onSkillChanged(characterBody.skillLocator.primary);
	}

	private void OnDestroy()
	{
		TeslaTrackerComponent obj = teslaTrackerComponent;
		obj.SearchEvent = (TeslaTrackerComponent.OnSearchEvent)Delegate.Remove(obj.SearchEvent, new TeslaTrackerComponent.OnSearchEvent(OnSearch));
	}

	private void Primary_onSkillChanged(GenericSkill genericSkill)
	{
		_isMelee = genericSkill.skillDef.skillNameToken == "HABIBI_TESLA_BODY_PRIMARY_PUNCH_NAME";
	}

	public HurtBox GetTowerTrackingTarget()
	{
		if (_targetingAlly)
		{
			return null;
		}
		if (!_hasTowerNear)
		{
			return null;
		}
		if ((Object)(object)_trackingTarget == (Object)null)
		{
			return null;
		}
		if ((Object)(object)_trackingTarget.hurtBoxGroup == (Object)null)
		{
			return null;
		}
		return _trackingTarget.hurtBoxGroup.mainHurtBox;
	}

	public HurtBox GetTrackingTarget()
	{
		return _trackingTarget;
	}

	public bool GetIsTargetingTeammate()
	{
		return _targetingAlly;
	}

	public RangeTier GetTrackingTargetDistance()
	{
		//IL_000e: 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)
		RangeTier result = RangeTier.FURTHEST;
		float num = Vector3.Distance(((Component)_trackingTarget).transform.position, ((Component)this).transform.position);
		if (num > mediumTrackingDistance)
		{
			result = RangeTier.FURTHEST;
		}
		if (num < mediumTrackingDistance)
		{
			result = RangeTier.MIDDLE;
		}
		if (num < nearTrackingDistance)
		{
			result = RangeTier.CLOSEST;
		}
		return result;
	}

	public void SetTowerLockedTarget(HealthComponent healthComponent)
	{
		_towerTargetHealthComponent = healthComponent;
	}

	public void SetIndicatorEmpowered(bool empowered)
	{
		indicator.empowered = empowered;
		_empowered = empowered;
	}

	private void setIndicatorRange(RangeTier tier)
	{
		indicator.currentRange = tier;
	}

	private void setIndicatorAlly()
	{
		indicator.targetingAlly = _targetingAlly;
	}

	private void setIndicatorTower(bool hasTower)
	{
		indicator.towerIsTargeting = hasTower;
	}

	private void OnEnable()
	{
		((Indicator)indicator).active = true;
	}

	private void OnDisable()
	{
		((Indicator)indicator).active = false;
	}

	private void FixedUpdate()
	{
		((Indicator)indicator).active = !_isMelee || _empowered;
	}

	private void OnSearch()
	{
		_trackingTarget = teslaTrackerComponent.trackingTargetZap;
		setIsTargetingTeammate();
		if (Object.op_Implicit((Object)(object)_trackingTarget))
		{
			setIndicatorRange(GetTrackingTargetDistance());
		}
		((Indicator)indicator).targetTransform = (Object.op_Implicit((Object)(object)_trackingTarget) ? ((Component)_trackingTarget).transform : null);
		if (Config.TowerTargeting.Value)
		{
			setIsTowerTargeting();
		}
	}

	private void setIsTowerTargeting()
	{
		bool indicatorTower = Object.op_Implicit((Object)(object)_towerTargetHealthComponent) && Object.op_Implicit((Object)(object)_trackingTarget) && (Object)(object)_towerTargetHealthComponent == (Object)(object)_trackingTarget.healthComponent;
		if (Object.op_Implicit((Object)(object)_towerTargetHealthComponent))
		{
			setIndicatorTower(indicatorTower);
			return;
		}
		_hasTowerNear = Object.op_Implicit((Object)(object)towerControllerComponent.GetNearestTower());
		setIndicatorTower(_hasTowerNear);
	}

	private void setIsTargetingTeammate()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		bool targetingAlly = false;
		if (Object.op_Implicit((Object)(object)_trackingTarget))
		{
			targetingAlly = !FriendlyFireManager.ShouldDirectHitProceed(_trackingTarget.healthComponent, teamComponent.teamIndex);
		}
		_targetingAlly = targetingAlly;
		setIndicatorAlly();
	}
}
public class TestValueManager : MonoBehaviour
{
	private float _tim;

	private float _holdTime = 0.4f;

	public static float value1 = 2.5f;

	public static float value2 = 690f;

	public static float value3 = 2000f;

	private bool _testingEnabled => Config.Debug;

	private void Update()
	{
		if (_testingEnabled && Input.GetKey((KeyCode)308))
		{
			manageTestValue(ref value1, "charge time", (KeyCode)263, (KeyCode)260, 0.1f);
			manageTestValue(ref value2, "min fors", (KeyCode)264, (KeyCode)261, 10f);
			manageTestValue(ref value3, "max fors", (KeyCode)265, (KeyCode)262, 10f);
		}
	}

	private void manageTestValue(ref float value, string valueName, KeyCode upKey, KeyCode downKey, float incrementAmount)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(upKey))
		{
			value = setTestValue(value + incrementAmount, valueName);
		}
		if (Input.GetKeyDown(downKey))
		{
			value = setTestValue(value - incrementAmount, valueName);
		}
		if (Input.GetKey(upKey) || Input.GetKey(downKey))
		{
			float num = incrementAmount * (float)(Input.GetKey(upKey) ? 1 : (-1));
			_tim += Time.deltaTime;
			if (_tim > _holdTime)
			{
				_tim = _holdTime - 0.02f;
				value = setTestValue(value + num, valueName);
			}
		}
		if (Input.GetKeyUp(upKey) || Input.GetKeyUp(downKey))
		{
			_tim = 0f;
		}
	}

	private float setTestValue(float value, string print)
	{
		Helpers.LogWarning(print + ": " + value.ToString("0.000"));
		return value;
	}
}
public enum TeslaVoiceLine
{
	attack_2000Volts,
	attack_HesFried,
	attack_CompletingCircuit,
	attack_Juice,
	attack_CommencingShock,
	move_GoingToSource,
	move_MovingOut,
	move_YesComrade,
	move_SurgingForward,
	move_Electrician,
	move_RubberShoes,
	select_TeslaSuit,
	select_ChargingUp,
	select_Electrodes,
	select_CheckingConnection
}
internal static class Helpers
{
	public const string agilePrefix = "<style=cIsUtility>Agile.</style> ";

	public static bool verbose;

	public static string DamageText(string text)
	{
		return "<style=cIsDamage>" + text + "</style>";
	}

	public static string DamageValueText(float value)
	{
		return $"<style=cIsDamage>{value * 100f}% damage</style>";
	}

	public static string UtilityText(string text)
	{
		return "<style=cIsUtility>" + text + "</style>";
	}

	public static string RedText(string text)
	{
		return HealthText(text);
	}

	public static string HealthText(string text)
	{
		return "<style=cIsHealth>" + text + "</style>";
	}

	internal static string KeywordText(string keyword, string sub)
	{
		return "<style=cKeywordName>" + keyword + "</style><style=cSub>" + sub + "</style>";
	}

	public static string ScepterDescription(string desc)
	{
		return "\n<color=#d299ff>SCEPTER: " + desc + "</color>";
	}

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

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

	public static void LogVerbose(object message, bool chat = false)
	{
		if (Config.Debug && verbose)
		{
			TeslaTrooperPlugin.Log.LogMessage(message);
			if (chat)
			{
				Chat.AddMessage(message.ToString());
			}
		}
	}

	public static void LogWarning(object message, bool chat = false)
	{
		if (Config.Debug)
		{
			TeslaTrooperPlugin.Log.LogWarning(message);
			if (chat)
			{
				Chat.AddMessage(message.ToString());
			}
		}
	}

	public static string GetVoiceLineString(TeslaVoiceLine line)
	{
		return line switch
		{
			TeslaVoiceLine.attack_2000Volts => "Play_itesata", 
			TeslaVoiceLine.attack_HesFried => "Play_itesatb", 
			TeslaVoiceLine.attack_CompletingCircuit => "Play_itesatc", 
			TeslaVoiceLine.attack_Juice => "Play_itesatd", 
			TeslaVoiceLine.attack_CommencingShock => "Play_itesate", 
			TeslaVoiceLine.move_GoingToSource => "Play_itesmoa", 
			TeslaVoiceLine.move_MovingOut => "Play_itesmob", 
			TeslaVoiceLine.move_YesComrade => "Play_itesmoc", 
			TeslaVoiceLine.move_SurgingForward => "Play_itesmod", 
			TeslaVoiceLine.move_RubberShoes => "Play_itesmof", 
			TeslaVoiceLine.select_TeslaSuit => "Play_itessea", 
			TeslaVoiceLine.select_ChargingUp => "Play_itesseb", 
			TeslaVoiceLine.select_Electrodes => "Play_itessec", 
			TeslaVoiceLine.select_CheckingConnection => "Play_itessed", 
			_ => "Play_itesmoe", 
		};
	}

	public static List<TeamComponent> GatherEnemies(TeamIndex allyIndex, params TeamIndex[] ignore)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Invalid comparison between Unknown and I4
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		List<TeamComponent> list = new List<TeamComponent>();
		bool flag = (int)FriendlyFireManager.friendlyFireMode > 0;
		IEnumerable<TeamIndex> enumerable = ((TeamIndex[])Enum.GetValues(typeof(TeamIndex))).Except(ignore);
		foreach (TeamIndex item in enumerable)
		{
			if (flag || allyIndex != item)
			{
				list.AddRange(TeamComponent.GetTeamMembers(item));
			}
		}
		return list;
	}
}
public static class ArrayHelper
{
	public static T[] Append<T>(ref T[] array, List<T> list)
	{
		int num = array.Length;
		int count = list.Count;
		Array.Resize(ref array, num + count);
		list.CopyTo(array, num);
		return array;
	}

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

	public string skillNameToken;

	public string skillDescriptionToken;

	public string[] keywordTokens = new string[0];

	public Sprite skillIcon;

	public SerializableEntityStateType activationState;

	public InterruptPriority interruptPriority;

	public string activationStateMachineName;

	public float baseRechargeInterval;

	public int baseMaxStock = 1;

	public int rechargeStock = 1;

	public int requiredStock = 1;

	public int stockToConsume = 1;

	public bool isCombatSkill = true;

	public bool canceledFromSprinting;

	public bool forceSprintDuringState;

	public bool cancelSprintingOnActivation = true;

	public bool beginSkillCooldownOnSkillEnd;

	public bool fullRestockOnAssign = true;

	public bool resetCooldownTimerOnUse;

	public bool mustKeyPress;

	public SkillDefInfo()
	{
	}

	public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName, InterruptPriority interruptPriority, bool isCombatSkill, float baseRechargeInterval)
	{
		//IL_0063: 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_0073: 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)
		this.skillName = skillName;
		this.skillNameToken = skillNameToken;
		this.skillDescriptionToken = skillDescriptionToken;
		this.skillIcon = skillIcon;
		this.activationState = activationState;
		this.activationStateMachineName = activationStateMachineName;
		this.interruptPriority = interruptPriority;
		this.isCombatSkill = isCombatSkill;
		this.baseRechargeInterval = baseRechargeInterval;
	}

	public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false)
	{
		//IL_0063: 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_0074: Unknown result type (might be due to invalid IL or missing references)
		this.skillName = skillName;
		this.skillNameToken = skillNameToken;
		this.skillDescriptionToken = skillDescriptionToken;
		this.skillIcon = skillIcon;
		this.activationState = activationState;
		this.activationStateMachineName = activationStateMachineName;
		interruptPriority = (InterruptPriority)0;
		isCombatSkill = true;
		baseRechargeInterval = 0f;
		requiredStock = 0;
		stockToConsume = 0;
		cancelSprintingOnActivation = !agile;
		if (agile)
		{
			keywordTokens = new string[1] { "KEYWORD_AGILE" };
		}
	}
}
[BepInPlugin("com.TheTimeSweeper.TeslaTrooper", "Tesla Trooper", "2.2.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class TeslaTrooperPlugin : BaseUnityPlugin
{
	public const string MODUID = "com.TheTimeSweeper.TeslaTrooper";

	public const string MODNAME = "Tesla Trooper";

	public const string MODVERSION = "2.2.3";

	public const string DEV_PREFIX = "HABIBI";

	public static TeslaTrooperPlugin instance;

	public static ManualLogSource Log;

	public static bool Desolator;

	public static bool holdonasec;

	private void Awake()
	{
		instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		Files.Init(((BaseUnityPlugin)this).Info);
		Language.HookRegisterLanguageTokens();
		Config.ReadConfig();
	}

	private void Start()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Initializing Tesla Trooper]");
		DamageTypes.RegisterDamageTypes();
		Assets.Initialize();
		SoundBanks.Init();
		if (Config.Debug)
		{
			((Component)this).gameObject.AddComponent<TestValueManager>();
		}
		Compat.Initialize();
		States.RegisterStates();
		ItemDisplays.PopulateDisplays();
		Colors.Init();
		Buffs.RegisterBuffs();
		Dots.RegisterDots();
		TeslaTowerNotSurvivor teslaTowerNotSurvivor = new TeslaTowerNotSurvivor();
		teslaTowerNotSurvivor.Initialize();
		new TeslaTowerScepter().Initialize(teslaTowerNotSurvivor);
		new TeslaTrooperSurvivor().Initialize();
		if (Desolator)
		{
			new DesolatorSurvivor().Initialize();
		}
		new ContentPacks().Initialize();
		Hook();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Initialized]");
	}

	private void Hook()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
		RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
		JitterBones.RebuildBones += new hook_RebuildBones(JitterBones_RebuildBones);
	}

	private void JitterBones_RebuildBones(orig_RebuildBones orig, JitterBones self)
	{
		if (!Object.op_Implicit((Object)(object)self._skinnedMeshRenderer) || !(((Object)self._skinnedMeshRenderer).name == "Tower_Base_Pillars_Color"))
		{
			orig.Invoke(self);
		}
	}

	private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
	{
		if (Desolator)
		{
			if (sender.HasBuff(Buffs.desolatorArmorBuff))
			{
				args.armorAdd += 100f;
				args.moveSpeedMultAdd += 0.4f;
			}
			if (sender.HasBuff(Buffs.desolatorDeployBuff))
			{
				args.armorAdd += 30f;
			}
			if (sender.HasBuff(Buffs.desolatorArmorShredDeBuff))
			{
				args.armorAdd -= DesolatorSurvivor.ArmorShredAmount * (float)sender.GetBuffCount(Buffs.desolatorArmorShredDeBuff);
			}
		}
	}

	private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Invalid comparison between Unknown and I4
		//IL_00d3: 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)
		bool flag = (damageInfo.damageType & 2) > 0;
		if (Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)self.body))
		{
			if (self.body.HasBuff(Buffs.zapShieldBuff) && !flag)
			{
				float damage = damageInfo.damage;
				if (Config.UtilityDamageAbsorption >= 1f)
				{
					damageInfo.rejected = true;
				}
				else
				{
					damage = (1f - Config.UtilityDamageAbsorption) * damageInfo.damage;
				}
				IReflectionBarrier component = ((Component)self).GetComponent<IReflectionBarrier>();
				if (component != null)
				{
					component.StoreDamage(damageInfo, damageInfo.damage);
					damageInfo.damage = damage;
				}
			}
			if (Desolator && self.body.HasBuff(Buffs.desolatorDeployBuff))
			{
				damageInfo.force = Vector3.zero;
			}
		}
		orig.Invoke(self, damageInfo);
	}

	private void ThrowGrenade_PlayAnimation(orig_PlayAnimation orig, ThrowGrenade self, float duration)
	{
		orig.Invoke(self, duration);
		Chat.AddMessage(((GenericProjectileBaseState)self).projectilePitchBonus.ToString());
	}
}
namespace ModdedEntityStates
{
	public class WindDownState : BaseSkillState
	{
		public float windDownTime = 0.5f;

		private float _windDownTime;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			_windDownTime = windDownTime / ((BaseState)this).attackSpeedStat;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge > _windDownTime)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		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;
		}
	}
}
namespace ModdedEntityStates.Desolator
{
	public class DesolatorMain : TeslaTrooperMain
	{
	}
	public class DesolatorVoiceLines : TeslaVoiceLines
	{
		protected override void playRandomvoiceLine(string prefix = "Play_")
		{
			base.playRandomvoiceLine("Play_Desolator_");
		}
	}
	public class EmoteRadiationProjectile : BaseSkillState
	{
		public static float DamageCoefficient = 0.2f;

		public static float Range = 10f;

		public GameObject deployProjectilePrefab => Assets.DesolatorDeployProjectileEmote;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			DropRadiationProjectile();
			((EntityState)this).outer.SetNextStateToMain();
		}

		protected void DropRadiationProjectile()
		{
			//IL_0003: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			FireProjectileInfo val = default(FireProjectileInfo);
			val.projectilePrefab = deployProjectilePrefab;
			val.crit = ((BaseState)this).RollCrit();
			val.force = 0f;
			val.damage = ((BaseState)this).damageStat * DamageCoefficient;
			val.owner = ((EntityState)this).gameObject;
			val.rotation = Quaternion.identity;
			val.position = ((BaseState)this).FindModelChild("MuzzleGauntlet").position;
			FireProjectileInfo val2 = val;
			ProjectileManager.instance.FireProjectile(val2);
		}
	}
	public class AimBigRadBeam : AimThrowableBase
	{
		public static float BlastDamageCoefficient = 3.2f;

		public static float PoolDamageCoefficient = 0.2f;

		public static float DotZoneLifetime = 2f;

		public static float BaseAttackRadius = 14.5f;

		private bool _crit;

		public override void OnEnter()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			AimStunDrone val = new AimStunDrone();
			base.arcVisualizerPrefab = ((AimThrowableBase)val).arcVisualizerPrefab;
			base.projectilePrefab = Assets.DesolatorCrocoLeapProjectile;
			base.endpointVisualizerPrefab = ((AimThrowableBase)val).endpointVisualizerPrefab;
			base.endpointVisualizerRadiusScale = BaseAttackRadius;
			base.maxDistance = 40f;
			base.rayRadius = 1.6f;
			base.setFuse = false;
			base.damageCoefficient = PoolDamageCoefficient;
			base.baseMinimumDuration = 0.2f;
			((AimThrowableBase)this).OnEnter();
			_crit = ((BaseState)this).RollCrit();
		}

		public override void ModifyProjectile(ref FireProjectileInfo fireProjectileInfo)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((AimThrowableBase)this).ModifyProjectile(ref fireProjectileInfo);
			fireProjectileInfo.position = base.currentTrajectoryInfo.hitPoint;
			fireProjectileInfo.rotation = Quaternion.identity;
			((FireProjectileInfo)(ref fireProjectileInfo)).speedOverride = 0f;
			fireProjectileInfo.crit = _crit;
		}

		public override void OnProjectileFiredLocal()
		{
			Util.PlaySound("Play_Desolator_Beam_Deep2", ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Desolator, Override", "DesolatorShootBig");
		}

		public override void FireProjectile()
		{
			//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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00d1: 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_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Expected O, but got Unknown
			//IL_00fc: 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_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Expected O, but got Unknown
			((AimThrowableBase)this).FireProjectile();
			EffectData val = new EffectData
			{
				origin = base.currentTrajectoryInfo.hitPoint,
				start = ((BaseState)this).FindModelChild("MuzzleGauntlet").position
			};
			val.SetChildLocatorTransformReference(((EntityState)this).gameObject, ((EntityState)this).GetModelChildLocator().FindChildIndex("MuzzleGauntlet"));
			EffectManager.SpawnEffect(Assets.DesolatorTracerRebar, val, true);
			if (((EntityState)this).isAuthority)
			{
				BlastAttack val2 = new BlastAttack
				{
					attacker = ((EntityState)this).gameObject,
					inflictor = ((EntityState)this).gameObject,
					teamIndex = ((EntityState)this).teamComponent.teamIndex,
					position = base.currentTrajectoryInfo.hitPoint,
					radius = BaseAttackRadius,
					falloffModel = (FalloffModel)0,
					baseDamage = ((BaseState)this).damageStat * BlastDamageCoefficient,
					crit = _crit,
					damageType = (DamageType)0,
					procCoefficient = 1f,
					baseForce = -5f
				};
				DamageAPI.AddModdedDamageType(val2, DamageTypes.DesolatorDot);
				val2.Fire();
				EffectManager.SpawnEffect(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/ImpactEffects/CrocoLeapExplosion"), new EffectData
				{
					origin = base.currentTrajectoryInfo.hitPoint,
					scale = BaseAttackRadius
				}, true);
			}
		}

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

		public override EntityState PickNextState()
		{
			WindDownState windDownState = new WindDownState();
			windDownState.windDownTime = 0.8f;
			return (EntityState)(object)windDownState;
		}
	}
	public class DeployCancel : BaseTimedSkillState
	{
		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			((EntityState)this).PlayCrossfade("FullBody, Override", "UnDeploy", "Deploy.playbackRate", 0.3f, 0.05f);
			((EntityState)this).PlayCrossfade("RadCannonBar", "DesolatorIdlePose", 0.1f);
			((EntityState)this).PlayCrossfade("RadCannonSpin", "DesolatorIdlePose", 0.1f);
			((EntityState)this).outer.SetNextStateToMain();
			if ((Object)(object)((EntityState)this).skillLocator.special.skillDef == (Object)(object)DesolatorSurvivor.cancelDeploySkillDef)
			{
				((EntityState)this).skillLocator.special.UnsetSkillOverride((object)((EntityState)this).gameObject, DesolatorSurvivor.cancelDeploySkillDef, (SkillOverridePriority)4);
			}
		}
	}
	public class DeployEnter : BaseTimedSkillState
	{
		public static float BaseDuration = 0.3f;

		public static float StartTime = 1f;

		public AimRequest aimRequest;

		protected bool _complete;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			InitDurationValues(BaseDuration, StartTime);
			aimRequest = ((EntityState)this).cameraTargetParams.RequestAimType((AimType)2);
			((EntityState)this).PlayCrossfade("FullBody, Override", "Deploy", "Deploy.playbackRate", duration, 0.05f);
			Animator modelAnimator = ((EntityState)this).GetModelAnimator();
			modelAnimator.SetFloat("CannonBarCharge", 1f);
			((EntityState)this).PlayAnimation("RadCannonBar", "CannonCharge");
			modelAnimator.SetFloat("CannonSpin", 0.99f);
			((EntityState)this).PlayCrossfade("RadCannonSpin", "CannonSpin", 0.1f);
			modelAnimator.SetFloat("aimYawCycle", 0.5f);
			modelAnimator.SetFloat("aimPitchCycle", 0.5f);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, BaseDuration);
			}
		}

		protected override EntityState ChooseNextState()
		{
			_complete = true;
			return (EntityState)(object)new DeployIrradiate
			{
				aimRequest = aimRequest,
				fromEnter = true
			};
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (_complete)
			{
				((EntityState)this).skillLocator.special.SetSkillOverride((object)((EntityState)this).gameObject, DesolatorSurvivor.cancelDeploySkillDef, (SkillOverridePriority)4);
				return;
			}
			aimRequest.Dispose();
			((EntityState)this).skillLocator.special.UnsetSkillOverride((object)((EntityState)this).gameObject, DesolatorSurvivor.cancelDeploySkillDef, (SkillOverridePriority)4);
			((EntityState)this).PlayCrossfade("RadCannonBar", "DesolatorIdlePose", 0.1f);
			((EntityState)this).PlayCrossfade("RadCannonSpin", "DesolatorIdlePose", 0.1f);
		}

		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)4;
		}
	}
	public class DeployIrradiate : BaseTimedSkillState
	{
		public static float DamageCoefficient = 0.2f;

		public static float BarrierPercentPerEnemy = 0.05f;

		public static float Range = 60f;

		public static float MaxBarrierPercent = 0.35f;

		public const float SqrBarrierRange = 1600f;

		public static float BaseDuration = 3f;

		public static float StartTime = 1f;

		public AimRequest aimRequest;

		public bool fromEnter;

		protected bool _complete;

		private Animator _animator;

		private float _cannonSpin;

		private bool _heldTooLongYaDoofus;

		private bool _inputDown;

		protected virtual GameObject deployProjectilePrefab => Assets.DesolatorDeployProjectile;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			InitDurationValues(BaseDuration, StartTime);
			_animator = ((EntityState)this).GetModelAnimator();
			Util.PlaySound("Play_Desolator_Deploy", ((EntityState)this).gameObject);
			((EntityState)this).PlayCrossfade("FullBody, Override", "DeployPump", 0.05f);
			if (((EntityState)this).isAuthority)
			{
				DropRadiationProjectile();
				GiveBarrierPerEnemy();
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.desolatorDeployBuff);
			}
			if (((EntityState)this).isAuthority && fromEnter && ((EntityState)this).inputBank.skill4.down)
			{
				_heldTooLongYaDoofus = true;
			}
			else
			{
				_inputDown = true;
			}
			((EntityState)this).characterBody.hideCrosshair = true;
		}

		public override void FixedUpdate()
		{
			base.FixedUpdate();
			duration = TimedBaseDuration / ((EntityState)this).characterBody.attackSpeed;
			if (_heldTooLongYaDoofus && ((EntityState)this).isAuthority && ((ButtonState)(ref ((EntityState)this).inputBank.skill4)).justReleased)
			{
				_heldTooLongYaDoofus = false;
			}
			if (!_heldTooLongYaDoofus && ((EntityState)this).isAuthority && ((ButtonState)(ref ((EntityState)this).inputBank.skill4)).justPressed)
			{
				_inputDown = true;
			}
			if (((EntityState)this).isAuthority && ((ButtonState)(ref ((EntityState)this).inputBank.skill4)).justReleased && _inputDown)
			{
				((EntityState)this).skillLocator.special.ExecuteIfReady();
			}
			if (((EntityState)this).isAuthority && ((ButtonState)(ref ((EntityState)this).inputBank.skill3)).justPressed)
			{
				((EntityState)this).skillLocator.utility.ExecuteIfReady();
			}
		}

		public override void Update()
		{
			base.Update();
			_cannonSpin = Mathf.Lerp(0f, 2.2f, ((EntityState)this).fixedAge / duration);
			_animator.SetFloat("CannonSpin", _cannonSpin, 0.1f, Time.deltaTime);
			_animator.SetFloat("CannonBarCharge", Mathf.Min(((EntityState)this).fixedAge / duration, 0.99f), 0.1f, Time.deltaTime);
		}

		private void GiveBarrierPerEnemy()
		{
			//IL_0007: 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_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			List<TeamComponent> list = Helpers.GatherEnemies(((EntityState)this).teamComponent.teamIndex);
			int num = 0;
			for (int i = 0; i < list.Count; i++)
			{
				if (Vector3.SqrMagnitude(((Component)list[i]).transform.position - ((EntityState)this).transform.position) < 1600f)
				{
					num++;
				}
			}
			float num2 = (float)num * BarrierPercentPerEnemy * ((EntityState)this).healthComponent.fullBarrier;
			float num3 = Mathf.Min(num2 + ((EntityState)this).healthComponent.barrier, ((EntityState)this).healthComponent.fullBarrier * MaxBarrierPercent);
			((EntityState)this).healthComponent.AddBarrierAuthority(Mathf.Max(num3 - ((EntityState)this).healthComponent.barrier, 0f));
		}

		protected void DropRadiationProjectile()
		{
			//IL_0003: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			FireProjectileInfo val = default(FireProjectileInfo);
			val.projectilePrefab = deployProjectilePrefab;
			val.crit = ((BaseState)this).RollCrit();
			val.force = 0f;
			val.damage = ((BaseState)this).damageStat * DamageCoefficient;
			val.owner = ((EntityState)this).gameObject;
			val.rotation = Quaternion.identity;
			val.position = ((EntityState)this).characterBody.corePosition;
			FireProjectileInfo fireProjectileInfo = val;
			ModifyProjectile(ref fireProjectileInfo);
			ProjectileManager.instance.FireProjectile(fireProjectileInfo);
		}

		protected virtual void ModifyProjectile(ref FireProjectileInfo fireProjectileInfo)
		{
		}

		protected override EntityState ChooseNextState()
		{
			_complete = true;
			return (EntityState)(object)new DeployIrradiate
			{
				aimRequest = aimRequest
			};
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			((EntityState)this).characterBody.hideCrosshair = false;
			if (!_complete)
			{
				AimRequest obj = aimRequest;
				if (obj != null)
				{
					obj.Dispose();
				}
				((EntityState)this).skillLocator.special.UnsetSkillOverride((object)((EntityState)this).gameObject, DesolatorSurvivor.cancelDeploySkillDef, (SkillOverridePriority)4);
				((EntityState)this).PlayCrossfade("FullBody, Override", "BufferEmpty", 0.5f);
				((EntityState)this).PlayCrossfade("RadCannonBar", "DesolatorIdlePose", 0.1f);
				((EntityState)this).PlayCrossfade("RadCannonSpin", "DesolatorIdlePose", 0.1f);
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.desolatorDeployBuff, 0.2f);
				((EntityState)this).characterBody.RemoveBuff(Buffs.desolatorDeployBuff);
			}
		}

		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)2;
		}
	}
	public class RadBeam : GenericBulletBaseState
	{
		public static float BaseDuration = 1f;

		public static float DamageCoefficient = 1f;

		public static int RadStacks = 2;

		public static float RadDamageMultiplier = 0.7f;

		public float skillsPlusDurationMultiplier = 1f;

		public override void OnEnter()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			FireSpear val = new FireSpear();
			base.baseDuration = BaseDuration * skillsPlusDurationMultiplier;
			base.bulletCount = 1;
			base.maxDistance = ((GenericBulletBaseState)val).maxDistance;
			base.bulletRadius = ((GenericBulletBaseState)val).bulletRadius;
			base.useSmartCollision = true;
			base.damageCoefficient = DamageCoefficient;
			base.procCoefficient = 1f;
			base.force = 100f;
			base.minSpread = 0f;
			base.maxSpread = 0f;
			base.spreadPitchScale = 1f;
			base.spreadYawScale = 1f;
			base.spreadBloomValue = TestValueManager.value3;
			base.recoilAmplitudeY = 1f;
			base.recoilAmplitudeX = 1f;
			base.muzzleName = "MuzzleGauntlet";
			base.fireSoundString = "Play_Desolator_Beam_Short";
			base.muzzleFlashPrefab = ((GenericBulletBaseState)val).muzzleFlashPrefab;
			base.tracerEffectPrefab = Assets.DesolatorTracerSnipe;
			base.hitEffectPrefab = Assets.IrradiatedImpactEffect;
			((GenericBulletBaseState)this).OnEnter();
			((EntityState)this).PlayAnimation("Desolator, Override", "DesolatorShoot");
		}

		public override void ModifyBullet(BulletAttack bulletAttack)
		{
			//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)
			bulletAttack.falloffModel = (FalloffModel)0;
			DamageAPI.AddModdedDamageType(bulletAttack, DamageTypes.DesolatorDotPrimary);
		}
	}
	public class RadiationAura : BaseSkillState
	{
		public static float BuffDuration = 4f;

		public static float Radius = 40f;

		public AimRequest aimRequest;

		private DesolatorAuraHolder _auraHolder;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			_auraHolder = ((EntityState)this).GetComponent<DesolatorAuraHolder>();
			_auraHolder?.ActivateAura();
			Util.PlaySound("Play_Desolator_Deploy_High", ((EntityState)this).gameObject);
			aimRequest = ((EntityState)this).cameraTargetParams.RequestAimType((AimType)2);
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddTimedBuff(Buffs.desolatorArmorBuff, BuffDuration);
			}
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge > BuffDuration)
			{
				if (aimRequest != null)
				{
					aimRequest.Dispose();
				}
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			_auraHolder?.DeactivateAura();
		}
	}
	public class RadiationAuraStart : BaseTimedSkillState
	{
		public static float BaseDuration = 1f;

		public static float BaseCastStartTime = 0f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			InitDurationValues(BaseDuration, BaseCastStartTime);
			((EntityState)this).PlayCrossfade("FullBody, Override", "CastShield", "CastShield.playbackRate", duration, 0.1f * duration);
			((EntityState)this).PlayCrossfade("Gesture, Override", "CastShield", "CastShield.playbackRate", duration, 0.1f * duration);
		}
	}
	public class ScepterDeployEnter : DeployEnter
	{
		protected override EntityState ChooseNextState()
		{
			_complete = true;
			return (EntityState)(object)new ScepterDeployIrradiate
			{
				aimRequest = aimRequest
			};
		}
	}
	public class ScepterDeployIrradiate : DeployIrradiate
	{
		public static float ScepterRange = 120f;

		protected override EntityState ChooseNextState()
		{
			_complete = true;
			return (EntityState)(object)new ScepterDeployIrradiate
			{
				aimRequest = aimRequest
			};
		}

		protected override void ModifyProjectile(ref FireProjectileInfo fireProjectileInfo)
		{
			fireProjectileInfo.projectilePrefab = Assets.DesolatorDeployProjectileScepter;
		}
	}
	public class ScepterThrowIrradiator : ThrowIrradiator
	{
		public static float finalExplosionDamageCoefficient = 16f;

		public static float explosionDamageCoefficient = finalExplosionDamageCoefficient / ThrowIrradiator.DamageCoefficient;

		protected override void ModifyProjectile(ref FireProjectileInfo fireProjectileInfo)
		{
			fireProjectileInfo.projectilePrefab = Assets.DesolatorIrradiatorProjectileScepter;
		}
	}
	public class ThrowIrradiator : BaseTimedSkillState
	{
		public static float DamageCoefficient = 0.15f;

		public static float Range = 35f;

		public static float BaseDuration = 1f;

		public static float StartTime = 0f;

		public override void OnEnter()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			InitDurationValues(BaseDuration, StartTime);
			((EntityState)this).PlayCrossfade("Gesture, Override", "DoPlace", 0.1f);
			if (((EntityState)this).isAuthority)
			{
				Ray aimRay = ((BaseState)this).GetAimRay();
				FireProjectileInfo val = default(FireProjectileInfo);
				val.crit = ((BaseState)this).RollCrit();
				val.damage = ((BaseState)this).damageStat * DamageCoefficient;
				val.damageColorIndex = (DamageColorIndex)0;
				val.force = 0f;
				val.owner = ((EntityState)this).gameObject;
				val.position = ((Ray)(ref aimRay)).origin;
				val.procChainMask = default(ProcChainMask);
				val.projectilePrefab = Assets.DesolatorIrradiatorProjectile;
				val.rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction);
				val.target = null;
				FireProjectileInfo fireProjectileInfo = val;
				ModifyProjectile(ref fireProjectileInfo);
				ProjectileManager.instance.FireProjectile(fireProjectileInfo);
			}
			Util.PlaySound("Play_Desolator_Deploy", ((EntityState)this).gameObject);
		}

		protected virtual void ModifyProjectile(ref FireProjectileInfo fireProjectileInfo)
		{
		}
	}
}
namespace ModdedEntityStates.BaseStates
{
	public class BaseMeleeAttackButEpic : BaseSkillState
	{
		public int swingIndex;

		protected string hitboxName = "Sword";

		protected DamageType damageType = (DamageType)0;

		protected float damageCoefficient = 3.5f;

		protected float procCoefficient = 1f;

		protected float pushForce = 300f;

		protected Vector3 bonusForce = Vector3.zero;

		protected float baseDuration = 1f;

		protected float attackStartTime = 0.2f;

		protected float attackEndTime = 0.4f;

		protected float baseEarlyExitTime = 0.4f;

		protected float hitStopDuration = 0.012f;

		protected float attackRecoil = 0.75f;

		protected float hitHopVelocity = 4f;

		protected bool cancelled = false;

		protected bool keypress;

		protected string swingSoundString = "";

		protected string hitSoundString = "";

		protected string muzzleString = "SwingCenter";

		protected string hitstopAnimationParameter;

		protected GameObject swingEffectPrefab;

		protected GameObject hitEffectPrefab;

		protected NetworkSoundEventIndex impactSound;

		private float earlyExitTime;

		protected float duration;

		private bool hasFired;

		private float hitPauseTimer;

		protected OverlapAttack attack;

		protected bool inHitPause;

		private bool hasHopped;

		protected float stopwatch;

		protected Animator animator;

		private HitStopCachedState hitStopCachedState;

		private Vector3 storedVelocity;

		protected bool rolledCrit;

		public override void OnEnter()
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			//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_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: 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_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / ((BaseState)this).attackSpeedStat;
			earlyExitTime = baseEarlyExitTime * duration;
			hasFired = false;
			animator = ((EntityState)this).GetModelAnimator();
			((BaseState)this).StartAimMode(0.5f + duration, false);
			((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
			animator.SetBool("attacking", true);
			rolledCrit = ((BaseState)this).RollCrit();
			HitBoxGroup hitBoxGroup = null;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
			}
			PlayAttackAnimation();
			attack = new OverlapAttack();
			attack.damageType = damageType;
			attack.attacker = ((EntityState)this).gameObject;
			attack.inflictor = ((EntityState)this).gameObject;
			attack.teamIndex = ((BaseState)this).GetTeam();
			attack.damage = damageCoefficient * ((BaseState)this).damageStat;
			attack.procCoefficient = procCoefficient;
			attack.hitEffectPrefab = hitEffectPrefab;
			attack.forceVector = bonusForce;
			attack.pushAwayForce = pushForce;
			attack.hitBoxGroup = hitBoxGroup;
			attack.isCrit = rolledCrit;
			attack.impactSound = impactSound;
			if (VRCompat.IsLocalVRPlayer(((EntityState)this).characterBody))
			{
				attackEndTime -= attackStartTime * 0.5f;
				attackStartTime = 0f;
			}
		}

		protected virtual void PlayAttackAnimation()
		{
			((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), "Slash.playbackRate", duration, 0.05f);
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			animator.SetBool("attacking", false);
		}

		protected virtual void PlaySwingEffect()
		{
			EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, true);
		}

		protected virtual void OnHitEnemyAuthority(List<HurtBox> hits = null)
		{
			Util.PlaySound(hitSoundString, ((EntityState)this).gameObject);
			if (!hasHopped)
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f)
				{
					((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity);
				}
				hasHopped = true;
			}
			ApplyHitstop();
		}

		protected void ApplyHitstop()
		{
			//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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			if (!inHitPause && hitStopDuration > 0f)
			{
				storedVelocity = ((EntityState)this).characterMotor.velocity;
				hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, hitstopAnimationParameter);
				hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat;
				inHitPause = true;
			}
		}

		protected virtual void FireAttack()
		{
			if (!hasFired)
			{
				hasFired = true;
				Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
				if (((EntityState)this).isAuthority)
				{
					PlaySwingEffect();
					((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil);
				}
			}
			if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null))
			{
				OnHitEnemyAuthority();
			}
		}

		protected virtual void SetNextState()
		{
			int num = ((swingIndex == 0) ? 1 : 0);
			((EntityState)this).outer.SetNextState((EntityState)(object)new BaseMeleeAttackButEpic
			{
				swingIndex = num
			});
		}

		public override void FixedUpdate()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			hitPauseTimer -= Time.fixedDeltaTime;
			if (hitPauseTimer <= 0f && inHitPause)
			{
				((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
				inHitPause = false;
				((EntityState)this).characterMotor.velocity = storedVelocity;
			}
			if (!inHitPause)
			{
				stopwatch += Time.fixedDeltaTime;
			}
			else
			{
				if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
				{
					((EntityState)this).characterMotor.velocity = Vector3.zero;
				}
				if (Object.op_Implicit((Object)(object)animator))
				{
					animator.SetFloat("Swing.playbackRate", 0f);
				}
			}
			bool flag = stopwatch >= duration * attackStartTime;
			bool flag2 = stopwatch >= duration * attackEndTime;
			if ((flag && !flag2) || (flag && flag2 && !hasFired))
			{
				if (!hasFired)
				{
					OnFireAttackEnter();
				}
				FireAttack();
			}
			if (stopwatch >= duration && ((EntityState)this).isAuthority)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		protected virtual void OnFireAttackEnter()
		{
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)((!(((EntityState)this).fixedAge > earlyExitTime)) ? 1 : 0);
		}

		public override void OnSerialize(NetworkWriter writer)
		{
			((BaseSkillState)this).OnSerialize(writer);
			writer.Write(swingIndex);
		}

		public override void OnDeserialize(NetworkReader reader)
		{
			((BaseSkillState)this).OnDeserialize(reader);
			swingIndex = reader.ReadInt32();
		}
	}
	public class BaseTimedSkillState : BaseSkillState
	{
		public float TimedBaseDuration;

		public float TimedBaseCastStartTime;

		public float TimedBaseCastEndTime;

		protected float duration;

		protected float castStartTime;

		protected float castEndTime;

		protected bool hasFired;

		protected bool isFiring;

		protected bool hasExited;

		protected virtual void InitDurationValues(float baseDuration, float baseCastStartTime, float baseCastEndTime = 1f)
		{
			TimedBaseDuration = baseDuration;
			TimedBaseCastStartTime = baseCastStartTime;
			TimedBaseCastEndTime = baseCastEndTime;
			duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat;
			castStartTime = baseCastStartTime * duration;
			castEndTime = baseCastEndTime * duration;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			bool flag = ((EntityState)this).fixedAge >= castStartTime;
			bool flag2 = ((EntityState)this).fixedAge >= castEndTime;
			isFiring = false;
			if ((flag && !flag2) || (flag && flag2 && !hasFired))
			{
				isFiring = true;
				OnCastFixedUpdate();
				if (!hasFired)
				{
					OnCastEnter();
					hasFired = true;
				}
			}
			if (flag2 && !hasExited)
			{
				hasExited = true;
				OnCastExit();
			}
			if (((EntityState)this).fixedAge > duration)
			{
				EntityState val = ChooseNextState();
				if (val == null)
				{
					((EntityState)this).outer.SetNextStateToMain();
				}
				else
				{
					((EntityState)this).outer.SetNextState(val);
				}
			}
		}

		protected virtual EntityState ChooseNextState()
		{
			return null;
		}

		public override void Update()
		{
			((EntityState)this).Update();
			if (isFiring)
			{
				OnCastUpdate();
			}
		}

		protected virtual void OnCastEnter()
		{
		}

		protected virtual void OnCastFixedUpdate()
		{
		}

		protected virtual void OnCastUpdate()
		{
		}

		protected virtual void OnCastExit()
		{
		}
	}
}
namespace ModdedEntityStates.TeslaTrooper
{
	public class BaseEmote : BaseState
	{
		public string soundString;

		public string animString;

		public float duration;

		private bool hasExploded;

		private uint activePlayID;

		private Animator animator;

		private ChildLocator childLocator;

		public LocalUser localUser;

		private CharacterCameraParamsData emoteCameraParams = new CharacterCameraParamsData
		{
			maxPitch = BlendableFloat.op_Implicit(70f),
			minPitch = BlendableFloat.op_Implicit(-70f),
			pivotVerticalOffset = BlendableFloat.op_Implicit(0.2f),
			idealLocalCameraPos = BlendableVector3.op_Implicit(emoteCameraPosition),
			wallCushion = BlendableFloat.op_Implicit(0.1f)
		};

		public static Vector3 emoteCameraPosition = new Vector3(0f, -0.8f, -10.2f);

		private CameraParamsOverrideHandle camOverrideHandle;

		public override void OnEnter()
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			((BaseState)this).OnEnter();
			animator = ((EntityState)this).GetModelAnimator();
			childLocator = ((EntityState)this).GetModelChildLocator();
			FindLocalUser();
			((EntityState)this).characterBody.hideCrosshair = true;
			if (Object.op_Implicit((Object)(object)((EntityState)this).GetAimAnimator()))
			{
				((Behaviour)((EntityState)this).GetAimAnimator()).enabled = false;
			}
			animator.SetLayerWeight(animator.GetLayerIndex("AimPitch"), 0f);
			animator.SetLayerWeight(animator.GetLayerIndex("AimYaw"), 0f);
			((EntityState)this).PlayAnimation("FullBody, Override", animString);
			activePlayID = Util.PlaySound(soundString, ((EntityState)this).gameObject);
			CameraParamsOverrideRequest val = default(CameraParamsOverrideRequest);
			val.cameraParamsData = emoteCameraParams;
			val.priority = 0f;
			CameraParamsOverrideRequest val2 = val;
			camOverrideHandle = ((EntityState)this).cameraTargetParams.AddParamsOverride(val2, 0.5f);
		}

		public override void OnExit()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).OnExit();
			((EntityState)this).characterBody.hideCrosshair = false;
			if (Object.op_Implicit((Object)(object)((EntityState)this).GetAimAnimator()))
			{
				((Behaviour)((EntityState)this).GetAimAnimator()).enabled = true;
			}
			animator.SetLayerWeight(animator.GetLayerIndex("AimPitch"), 1f);
			animator.SetLayerWeight(animator.GetLayerIndex("AimYaw"), 1f);
			((EntityState)this).PlayAnimation("FullBody, Override", "BufferEmpty");
			if (activePlayID != 0)
			{
				AkSoundEngine.StopPlayingID(activePlayID);
			}
			((EntityState)this).cameraTargetParams.RemoveParamsOverride(camOverrideHandle, 0.5f);
		}

		public override void FixedUpdate()
		{
			//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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			bool flag = false;
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
			{
				if (!((EntityState)this).characterMotor.isGrounded)
				{
					flag = true;
				}
				if (((EntityState)this).characterMotor.velocity != Vector3.zero)
				{
					flag = true;
				}
			}
			if (Object.op_Implicit((Object)(object)((EntityState)this).inputBank))
			{
				if (((EntityState)this).inputBank.skill1.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.skill2.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.skill3.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.skill4.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.jump.down)
				{
					flag = true;
				}
				if (((EntityState)this).inputBank.moveVector != Vector3.zero)
				{
					flag = true;
				}
			}
			if (((EntityState)this).isAuthority && ((EntityState)this).characterMotor.isGrounded)
			{
				CheckEmote<Rest>(Config.restKeybind);
			}
			if (duration > 0f && ((EntityState)this).fixedAge >= duration)
			{
				flag = true;
			}
			if (flag)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
		}

		private void CheckEmote(KeyCode keybind, EntityState state)
		{
			//IL_0001: U