Decompiled source of Direseeker v2.1.0

plugins/EnforcerGang-Direseeker/Direseeker.dll

Decompiled 2 days ago
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 AccurateEnemies;
using BepInEx;
using BepInEx.Bootstrap;
using Direseeker;
using DireseekerMod.Components;
using DireseekerMod.Modules;
using DireseekerMod.States;
using DireseekerMod.States.Missions.DireseekerEncounter;
using DireseekerMod.States.Sun;
using EntityStates;
using EntityStates.LemurianBruiserMonster;
using EntityStates.TitanMonster;
using KinematicCharacterController;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.Navigation;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPaths;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.Rendering.PostProcessing;
using UnityEngine.SceneManagement;
using Zio.FileSystems;

[assembly: AssemblyInformationalVersion("1.0.0+8a0bb531cf64c84109ee1cc41351e138c4a8daf5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyProduct("Direseeker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyCompany("Direseeker")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyTitle("Direseeker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public class DireseekerSunNetworkController : NetworkBehaviour
{
	private static int kRpcRpcPosition;

	[ClientRpc]
	public void RpcPosition(GameObject networkedGameObject)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		Transform parent = ((Component)networkedGameObject.GetComponent<ModelLocator>().modelTransform).GetComponent<ChildLocator>().FindChild("Chest");
		((Component)this).transform.SetParent(parent);
		((Component)this).transform.position = ((Component)this).transform.parent.position + Vector3.up * DireseekerSunController.sunHeight;
	}

	private void UNetVersion()
	{
	}

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

	public void CallRpcPosition(GameObject networkedGameObject)
	{
		//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 RpcPosition called on client.");
			return;
		}
		NetworkWriter val = new NetworkWriter();
		val.Write((short)0);
		val.Write((short)2);
		val.WritePackedUInt32((uint)kRpcRpcPosition);
		val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
		val.Write(networkedGameObject);
		((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcPosition");
	}

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

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

	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
	}
}
[RequireComponent(typeof(TeamFilter))]
public class DireseekerSunController : MonoBehaviour
{
	private TeamFilter teamFilter;

	private GameObject ownerObj;

	private CharacterBody ownerBody;

	public BuffDef buffDef;

	public GameObject buffApplyEffect;

	public static float sunHeight = 5f;

	[SerializeField]
	public LoopSoundDef activeLoopDef;

	[SerializeField]
	public LoopSoundDef damageLoopDef;

	[SerializeField]
	public string stopSoundName;

	private float cycleInterval;

	private FixedTimeStamp previousCycle = FixedTimeStamp.negativeInfinity;

	private int cycleIndex;

	private List<HurtBox> cycleTargets = new List<HurtBox>();

	private BullseyeSearch bullseyeSearch = new BullseyeSearch();

	private bool isLocalPlayerDamaged;

	private bool crit;

	private void Awake()
	{
		teamFilter = ((Component)this).GetComponent<TeamFilter>();
	}

	private void Start()
	{
		ownerObj = (Object.op_Implicit((Object)(object)((Component)this).GetComponent<GenericOwnership>()) ? ((Component)this).GetComponent<GenericOwnership>().ownerObject : ((Component)this).GetComponent<ProjectileController>().owner);
		ownerBody = ownerObj.GetComponent<CharacterBody>();
		cycleInterval = 0.5f / ownerBody.attackSpeed;
		crit = ownerBody.RollCrit();
		if (Object.op_Implicit((Object)(object)activeLoopDef))
		{
			Util.PlaySound(activeLoopDef.startSoundName, ((Component)this).gameObject);
		}
	}

	private void OnDisable()
	{
		OnDestroy();
	}

	private void OnDestroy()
	{
		if (Object.op_Implicit((Object)(object)activeLoopDef))
		{
			Util.PlaySound(activeLoopDef.stopSoundName, ((Component)this).gameObject);
		}
		if (Object.op_Implicit((Object)(object)damageLoopDef))
		{
			Util.PlaySound(damageLoopDef.stopSoundName, ((Component)this).gameObject);
		}
		if (stopSoundName != null)
		{
			Util.PlaySound(stopSoundName, ((Component)this).gameObject);
		}
		AkSoundEngine.StopPlayingID(3203163036u);
	}

	private void LateUpdate()
	{
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		if ((Object)(object)((Component)this).transform.parent != (Object)null)
		{
			((Component)this).transform.position = ((Component)this).transform.parent.position + Vector3.up * sunHeight;
		}
	}

	private void FixedUpdate()
	{
		//IL_0091: 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_00b5: 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_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
		if (NetworkServer.active)
		{
			ServerFixedUpdate();
		}
		if (!Object.op_Implicit((Object)(object)damageLoopDef))
		{
			return;
		}
		bool flag = isLocalPlayerDamaged;
		isLocalPlayerDamaged = false;
		RaycastHit val2 = default(RaycastHit);
		foreach (HurtBox cycleTarget in cycleTargets)
		{
			CharacterBody val = null;
			if (Object.op_Implicit((Object)(object)cycleTarget) && Object.op_Implicit((Object)(object)cycleTarget.healthComponent))
			{
				val = cycleTarget.healthComponent.body;
			}
			if (Object.op_Implicit((Object)(object)val) && (val.bodyFlags & 0x200) != 0 && val.hasEffectiveAuthority)
			{
				Vector3 position = ((Component)this).transform.position;
				Vector3 corePosition = val.corePosition;
				if (!Physics.Linecast(position, corePosition, ref val2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					isLocalPlayerDamaged = true;
				}
			}
		}
		if (isLocalPlayerDamaged && !flag)
		{
			Util.PlaySound(damageLoopDef.startSoundName, ((Component)this).gameObject);
		}
		else if (!isLocalPlayerDamaged && flag)
		{
			Util.PlaySound(damageLoopDef.stopSoundName, ((Component)this).gameObject);
		}
	}

	private void ServerFixedUpdate()
	{
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Invalid comparison between Unknown and I4
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0109: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0184: Unknown result type (might be due to invalid IL or missing references)
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: Unknown result type (might be due to invalid IL or missing references)
		//IL_019b: Unknown result type (might be due to invalid IL or missing references)
		//IL_01aa: Expected O, but got Unknown
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_031b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0244: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
		float num = Mathf.Clamp01(((FixedTimeStamp)(ref previousCycle)).timeSince / cycleInterval);
		int num2 = ((num == 1f) ? cycleTargets.Count : Mathf.FloorToInt((float)cycleTargets.Count * num));
		Vector3 position = ((Component)this).transform.position;
		Ray val2 = default(Ray);
		RaycastHit val3 = default(RaycastHit);
		while (cycleIndex < num2)
		{
			HurtBox val = cycleTargets[cycleIndex];
			if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent))
			{
				CharacterBody body = val.healthComponent.body;
				if (Object.op_Implicit((Object)(object)ownerBody))
				{
					bool flag = false;
					bool flag2 = !flag && body.GetBuffCount(Buffs.Overheat) < 5;
					bool flag3 = (body.bodyFlags & 0x200) == 0 || (int)body.teamComponent.teamIndex != 1;
					if ((flag || flag2) && flag3)
					{
						Vector3 corePosition = body.corePosition;
						((Ray)(ref val2))..ctor(position, corePosition - position);
						if (!Physics.Linecast(position, corePosition, ref val3, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
						{
							float num3 = Mathf.Max(1f, ((RaycastHit)(ref val3)).distance);
							body.AddTimedBuff(buffDef, 1f / num3);
							if (Object.op_Implicit((Object)(object)buffApplyEffect))
							{
								EffectData val4 = new EffectData
								{
									origin = corePosition,
									rotation = Util.QuaternionSafeLookRotation(-((Ray)(ref val2)).direction),
									scale = body.bestFitRadius
								};
								val4.SetHurtBoxReference(val);
								EffectManager.SpawnEffect(buffApplyEffect, val4, true);
							}
							int buffCount = body.GetBuffCount(buffDef);
							if (buffCount >= 2)
							{
								InflictDotInfo val5 = default(InflictDotInfo);
								val5.dotIndex = (DotIndex)1;
								val5.attackerObject = ownerObj;
								val5.victimObject = ((Component)body).gameObject;
								if (Object.op_Implicit((Object)(object)ownerBody) && Object.op_Implicit((Object)(object)ownerBody.inventory))
								{
									TeamDef teamDef = TeamCatalog.GetTeamDef(ownerBody.teamComponent.teamIndex);
									float num4 = 1f;
									if (teamDef != null && teamDef.friendlyFireScaling > 0f)
									{
										num4 *= teamDef.friendlyFireScaling;
									}
									float num5 = ((!flag || !crit) ? 1 : 2);
									if ((body.teamComponent.teamIndex == ownerBody.teamComponent.teamIndex) & ((Object)(object)body != (Object)(object)ownerBody))
									{
										num4 *= 8f;
									}
									val5.totalDamage = 0.01f * ownerBody.damage * (float)buffCount * num4 * num5;
									val5.damageMultiplier = 1f * num4;
									StrengthenBurnUtils.CheckDotForUpgrade(ownerBody.inventory, ref val5);
								}
								if (val5.totalDamage > 0f)
								{
									DotController.InflictDot(ref val5);
								}
							}
						}
					}
				}
			}
			cycleIndex++;
		}
		if (((FixedTimeStamp)(ref previousCycle)).timeSince >= cycleInterval)
		{
			previousCycle = FixedTimeStamp.now;
			cycleIndex = 0;
			cycleTargets.Clear();
			SearchForTargets(cycleTargets);
		}
	}

	private void SearchForTargets(List<HurtBox> dest)
	{
		//IL_000d: 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_005c: Unknown result type (might be due to invalid IL or missing references)
		bullseyeSearch.searchOrigin = ((Component)this).transform.position;
		bullseyeSearch.minAngleFilter = 0f;
		bullseyeSearch.maxAngleFilter = 180f;
		bullseyeSearch.maxDistanceFilter = 180f;
		bullseyeSearch.filterByDistinctEntity = true;
		bullseyeSearch.sortMode = (SortMode)1;
		bullseyeSearch.viewer = null;
		bullseyeSearch.RefreshCandidates();
		dest.AddRange(bullseyeSearch.GetResults());
	}
}
namespace Direseeker
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.rob.Direseeker", "Direseeker", "2.0.609")]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class DireseekerPlugin : BaseUnityPlugin
	{
		public static bool AccurateEnemiesLoaded = false;

		public static bool AccurateEnemiesCompat = true;

		public static PluginInfo pluginInfo;

		public void Awake()
		{
			AccurateEnemiesLoaded = Chainloader.PluginInfos.ContainsKey("com.Moffein.AccurateEnemies");
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Assets.PopulateAssets();
			Tokens.RegisterLanguageTokens();
			Prefabs.CreatePrefab();
			States.RegisterStates();
			Skills.RegisterSkills();
			Projectiles.CreateProjectiles();
			SpawnCards.CreateSpawnCards();
			Assets.UpdateAssets();
			new Hooks().ApplyHooks();
		}
	}
}
namespace DireseekerMod.States
{
	public class ChargeUltraFireball : BaseState
	{
		public static float baseDuration = 2f;

		private float duration;

		private GameObject chargeInstance;

		public override void OnEnter()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			Animator modelAnimator = ((EntityState)this).GetModelAnimator();
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			Util.PlayAttackSpeedSound("sfx_direseeker_charge", ((EntityState)this).gameObject, base.attackSpeedStat);
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				ChildLocator component = ((Component)modelTransform).GetComponent<ChildLocator>();
				if (Object.op_Implicit((Object)(object)component))
				{
					Transform val = component.FindChild("MuzzleMouth");
					if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)ChargeMegaFireball.chargeEffectPrefab))
					{
						chargeInstance = Object.Instantiate<GameObject>(ChargeMegaFireball.chargeEffectPrefab, val.position, val.rotation);
						chargeInstance.transform.parent = val;
						ScaleParticleSystemDuration component2 = chargeInstance.GetComponent<ScaleParticleSystemDuration>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							component2.newDuration = duration;
						}
					}
				}
			}
			if (Object.op_Implicit((Object)(object)modelAnimator))
			{
				((EntityState)this).PlayCrossfade("Gesture, Additive", "ChargeMegaFireball", "ChargeMegaFireball.playbackRate", duration, 0.1f);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)chargeInstance))
			{
				EntityState.Destroy((Object)(object)chargeInstance);
			}
		}

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

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				FireUltraFireball nextState = new FireUltraFireball();
				((EntityState)this).outer.SetNextState((EntityState)(object)nextState);
			}
		}

		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 Enrage : BaseState
	{
		private static Material onFireMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/matOnFire.mat").WaitForCompletion();

		public static float baseEntryDuration = 1.5f;

		public static float baseExitDuration = 6f;

		private float stopwatch;

		private float entryDuration;

		private float exitDuration;

		private bool hasEnraged;

		private bool heck;

		private bool stoppedSound = false;

		private ChildLocator childLocator;

		private DireseekerController direController;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			stopwatch = 0f;
			entryDuration = baseEntryDuration / base.attackSpeedStat;
			exitDuration = baseExitDuration / base.attackSpeedStat;
			childLocator = ((EntityState)this).GetModelChildLocator();
			direController = ((EntityState)this).GetComponent<DireseekerController>();
			if (Object.op_Implicit((Object)(object)direController))
			{
				direController.StartRageMode();
			}
			if (NetworkServer.active)
			{
				((EntityState)this).characterBody.AddBuff(Buffs.ArmorBoost);
			}
			((EntityState)this).PlayAnimation("Gesture, Override", "PrepFlamebreath", "PrepFlamebreath.playbackRate", entryDuration, 0f);
			Util.PlaySound("sfx_direseeker_woosh", ((EntityState)this).gameObject);
		}

		private void GrantItems()
		{
			if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.master.inventory))
			{
				((EntityState)this).characterBody.master.inventory.GiveItem(Items.AdaptiveArmor, 1);
				((EntityState)this).characterBody.master.inventory.GiveItem(Items.AlienHead, 10);
				((EntityState)this).characterBody.master.inventory.GiveItem(Items.Hoof, 3);
				((EntityState)this).characterBody.master.inventory.GiveItem(Items.Syringe, 3);
			}
		}

		public override void OnExit()
		{
			((EntityState)this).PlayCrossfade("Gesture, Override", "BufferEmpty", 0.1f);
			((EntityState)this).OnExit();
		}

		private void SpawnSun()
		{
			if (NetworkServer.active)
			{
				GameObject val = Object.Instantiate<GameObject>(Assets.sunPrefab);
				val.GetComponent<GenericOwnership>().ownerObject = ((EntityState)this).gameObject;
				NetworkServer.Spawn(val);
				val.GetComponent<DireseekerSunNetworkController>().CallRpcPosition(((EntityState)this).gameObject);
			}
		}

		public override void FixedUpdate()
		{
			//IL_0093: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Expected O, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: 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_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			stopwatch += ((EntityState)this).GetDeltaTime();
			if (stopwatch >= entryDuration && !hasEnraged)
			{
				hasEnraged = true;
				((EntityState)this).characterBody.baseRegen = -20f;
				GrantItems();
				SpawnSun();
				Util.PlaySound("sfx_direseeker_roar", ((EntityState)this).gameObject);
				GameObject val = Object.Instantiate<GameObject>(Assets.roarEffect);
				Transform val2 = ((BaseState)this).FindModelChild("MuzzleMouth");
				val.transform.position = val2.position;
				val.transform.rotation = val2.rotation;
				val.transform.parent = val2;
				Object.Destroy((Object)(object)val, 30f);
				BlastAttack val3 = new BlastAttack();
				val3.attacker = ((EntityState)this).gameObject;
				val3.inflictor = ((EntityState)this).gameObject;
				val3.teamIndex = (TeamIndex)0;
				val3.procCoefficient = 0f;
				val3.radius = 120f;
				val3.baseForce = 8000f;
				val3.bonusForce = Vector3.up * 200f;
				val3.baseDamage = 0f;
				val3.falloffModel = (FalloffModel)1;
				val3.damageColorIndex = (DamageColorIndex)0;
				val3.attackerFiltering = (AttackerFiltering)2;
				val3.damageType = DamageTypeCombo.op_Implicit((DamageType)32);
				val3.position = ((EntityState)this).transform.position;
				val3.Fire();
				stoppedSound = true;
				Transform modelTransform = ((EntityState)this).GetModelTransform();
				if (Object.op_Implicit((Object)(object)modelTransform))
				{
					CharacterModel component = ((Component)modelTransform).gameObject.GetComponent<CharacterModel>();
					if (Object.op_Implicit((Object)(object)component))
					{
						if (component.temporaryOverlays == null)
						{
							component.temporaryOverlays = new List<TemporaryOverlayInstance>();
						}
						TemporaryOverlayInstance val4 = TemporaryOverlayManager.AddOverlay(((Component)component).gameObject);
						val4.duration = 1000f;
						val4.animateShaderAlpha = true;
						val4.alphaCurve = AnimationCurve.EaseInOut(0f, 10f, 1f, 10f);
						val4.destroyComponentOnEnd = false;
						val4.originalMaterial = onFireMat;
						val4.inspectorCharacterModel = component;
						val4.Start();
					}
				}
				((EntityState)this).PlayAnimation("Gesture, Override", "Flamebreath", "Flamebreath.playbackRate", exitDuration, 0f);
			}
			if (stopwatch >= entryDuration + 0.75f * exitDuration && !heck)
			{
				heck = true;
				((EntityState)this).PlayCrossfade("Gesture, Override", "ExitFlamebreath", "ExitFlamebreath.playbackRate", 0.75f * exitDuration, 0.1f);
				if (!NetworkServer.active)
				{
				}
			}
			if (stopwatch >= entryDuration + exitDuration && ((EntityState)this).isAuthority)
			{
				((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;
		}
	}
	public class FireUltraFireball : BaseState
	{
		public static int projectileCount = 15;

		public static float totalYawSpread = 25f;

		public static float baseDuration = 1.5f;

		public static float baseFireDuration = 0.25f;

		public static float damageCoefficient = 1.4f;

		public static float projectileSpeed = 80f;

		public static float force = 1200f;

		private float duration;

		private float fireDuration;

		private int projectilesFired;

		private DireseekerController direController;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			duration = baseDuration / base.attackSpeedStat;
			fireDuration = baseFireDuration / base.attackSpeedStat;
			direController = ((EntityState)this).GetComponent<DireseekerController>();
			if (Object.op_Implicit((Object)(object)direController))
			{
				direController.FlameBurst();
			}
			((EntityState)this).PlayAnimation("Gesture, Additive", "FireMegaFireball", "FireMegaFireball.playbackRate", duration, 0f);
			Util.PlaySound("sfx_direseeker_fire", ((EntityState)this).gameObject);
		}

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

		public override void FixedUpdate()
		{
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			((EntityState)this).FixedUpdate();
			string text = "MuzzleMouth";
			if (((EntityState)this).isAuthority)
			{
				int num = Mathf.FloorToInt(((EntityState)this).fixedAge / fireDuration * (float)projectileCount);
				if (projectilesFired <= num && projectilesFired < projectileCount)
				{
					if (Object.op_Implicit((Object)(object)FireMegaFireball.muzzleflashEffectPrefab))
					{
						EffectManager.SimpleMuzzleFlash(FireMegaFireball.muzzleflashEffectPrefab, ((EntityState)this).gameObject, text, false);
					}
					Ray val = ((BaseState)this).GetAimRay();
					float num2 = projectileSpeed;
					if (DireseekerPlugin.AccurateEnemiesLoaded && DireseekerPlugin.AccurateEnemiesCompat)
					{
						val = PredictAimRay(val, num2);
					}
					Vector3 point = ((Ray)(ref val)).GetPoint(100f);
					RaycastHit val2 = default(RaycastHit);
					if (Physics.Raycast(val, ref val2, 100f, LayerMask.op_Implicit(CommonMasks.bullet), (QueryTriggerInteraction)0))
					{
						point = ((RaycastHit)(ref val2)).point;
					}
					Vector3 position = ((BaseState)this).FindModelChild(text).position;
					((Ray)(ref val))..ctor(position, point - position);
					float num3 = (float)Mathf.FloorToInt((float)projectilesFired - (float)(projectileCount - 1) / 2f) / (float)(projectileCount - 1) * totalYawSpread;
					Vector3 val3 = Util.ApplySpread(((Ray)(ref val)).direction, 0f, 0f, 1f, 1f, num3, 0f);
					ProjectileManager.instance.FireProjectile(Projectiles.fireballPrefab, position, Util.QuaternionSafeLookRotation(val3), ((EntityState)this).gameObject, base.damageStat * damageCoefficient, force, ((BaseState)this).RollCrit(), (DamageColorIndex)0, (GameObject)null, num2, (DamageTypeCombo?)null);
					projectilesFired++;
				}
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				((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)2;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		private Ray PredictAimRay(Ray aimRay, float speedOverride)
		{
			//IL_009b: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: 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)
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) && !((EntityState)this).characterBody.isPlayerControlled && (AccurateEnemiesPlugin.alwaysAllowBosses || !AccurateEnemiesPlugin.eliteOnly || ((EntityState)this).characterBody.isElite))
			{
				HurtBox masterAITargetHurtbox = Util.GetMasterAITargetHurtbox(((EntityState)this).characterBody.master);
				Ray result;
				if (speedOverride > 0f)
				{
					speedOverride = AccurateEnemiesPlugin.GetProjectileSimpleModifiers(speedOverride);
					result = Util.PredictAimray(aimRay, ((BaseState)this).GetTeam(), AccurateEnemiesPlugin.basePredictionAngle, speedOverride, masterAITargetHurtbox);
				}
				else
				{
					result = Util.PredictAimrayPS(aimRay, ((BaseState)this).GetTeam(), AccurateEnemiesPlugin.basePredictionAngle, Projectiles.fireballPrefab, masterAITargetHurtbox);
				}
				return result;
			}
			return aimRay;
		}
	}
	public class FlamePillar : BaseState
	{
		private enum SubState
		{
			Prep,
			FirePillar,
			Exit
		}

		private class Predictor
		{
			private enum ExtrapolationType
			{
				None,
				Linear,
				Polar
			}

			private Transform bodyTransform;

			private Transform targetTransform;

			private Vector3 targetPosition0;

			private Vector3 targetPosition1;

			private Vector3 targetPosition2;

			private int collectedPositions;

			public bool hasTargetTransform => Object.op_Implicit((Object)(object)targetTransform);

			public bool isPredictionReady => collectedPositions > 2;

			public Predictor(Transform bodyTransform)
			{
				this.bodyTransform = bodyTransform;
			}

			private void PushTargetPosition(Vector3 newTargetPosition)
			{
				//IL_0003: 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_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: 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)
				targetPosition2 = targetPosition1;
				targetPosition1 = targetPosition0;
				targetPosition0 = newTargetPosition;
				collectedPositions++;
			}

			public void SetTargetTransform(Transform newTargetTransform)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: 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)
				//IL_0018: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: 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)
				//IL_0021: Unknown result type (might be due to invalid IL or missing references)
				targetTransform = newTargetTransform;
				targetPosition2 = (targetPosition1 = (targetPosition0 = newTargetTransform.position));
				collectedPositions = 1;
			}

			public void Update()
			{
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				if (Object.op_Implicit((Object)(object)targetTransform))
				{
					PushTargetPosition(targetTransform.position);
				}
			}

			public bool GetPredictedTargetPosition(float time, out Vector3 predictedPosition)
			{
				//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_000d: 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_0014: 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)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: 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_004a: 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_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0222: Unknown result type (might be due to invalid IL or missing references)
				//IL_0227: Unknown result type (might be due to invalid IL or missing references)
				//IL_022c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0231: Unknown result type (might be due to invalid IL or missing references)
				//IL_0236: Unknown result type (might be due to invalid IL or missing references)
				//IL_023d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0242: Unknown result type (might be due to invalid IL or missing references)
				//IL_024c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0251: Unknown result type (might be due to invalid IL or missing references)
				//IL_0256: Unknown result type (might be due to invalid IL or missing references)
				//IL_025b: Unknown result type (might be due to invalid IL or missing references)
				//IL_026c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
				//IL_0102: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_0155: Unknown result type (might be due to invalid IL or missing references)
				//IL_0157: Unknown result type (might be due to invalid IL or missing references)
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_016d: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_028a: Unknown result type (might be due to invalid IL or missing references)
				//IL_028f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_0212: Unknown result type (might be due to invalid IL or missing references)
				Vector3 val = targetPosition1 - targetPosition2;
				Vector3 val2 = targetPosition0 - targetPosition1;
				val.y = 0f;
				val2.y = 0f;
				ExtrapolationType extrapolationType;
				if (val == Vector3.zero || val2 == Vector3.zero)
				{
					extrapolationType = ExtrapolationType.None;
				}
				else
				{
					Vector3 normalized = ((Vector3)(ref val)).normalized;
					Vector3 normalized2 = ((Vector3)(ref val2)).normalized;
					extrapolationType = ((Vector3.Dot(normalized, normalized2) > 0.98f) ? ExtrapolationType.Linear : ExtrapolationType.Polar);
				}
				float num = 1f / Time.fixedDeltaTime;
				predictedPosition = targetPosition0;
				switch (extrapolationType)
				{
				case ExtrapolationType.Polar:
				{
					Vector3 position = bodyTransform.position;
					Vector3 val3 = Vector2.op_Implicit(Util.Vector3XZToVector2XY(targetPosition2 - position));
					Vector3 val4 = Vector2.op_Implicit(Util.Vector3XZToVector2XY(targetPosition1 - position));
					Vector3 val5 = Vector2.op_Implicit(Util.Vector3XZToVector2XY(targetPosition0 - position));
					float magnitude = ((Vector3)(ref val3)).magnitude;
					float magnitude2 = ((Vector3)(ref val4)).magnitude;
					float magnitude3 = ((Vector3)(ref val5)).magnitude;
					float num2 = Vector2.SignedAngle(Vector2.op_Implicit(val3), Vector2.op_Implicit(val4)) * num;
					float num3 = Vector2.SignedAngle(Vector2.op_Implicit(val4), Vector2.op_Implicit(val5)) * num;
					float num4 = (magnitude2 - magnitude) * num;
					float num5 = (magnitude3 - magnitude2) * num;
					float num6 = (num2 + num3) * 0.5f;
					float num7 = (num4 + num5) * 0.5f;
					float num8 = magnitude3 + num7 * time;
					if (num8 < 0f)
					{
						num8 = 0f;
					}
					Vector2 val6 = Util.RotateVector2(Vector2.op_Implicit(val5), num6 * time);
					val6 *= num8 * magnitude3;
					predictedPosition = position;
					predictedPosition.x += val6.x;
					predictedPosition.z += val6.y;
					break;
				}
				case ExtrapolationType.Linear:
					predictedPosition = targetPosition0 + val2 * (time * num);
					break;
				}
				RaycastHit val7 = default(RaycastHit);
				if (Physics.Raycast(new Ray(predictedPosition + Vector3.up * 1f, Vector3.down), ref val7, 200f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
				{
					predictedPosition = ((RaycastHit)(ref val7)).point;
					return true;
				}
				return false;
			}
		}

		private static Material onFireMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/matOnFire.mat").WaitForCompletion();

		private static GameObject genericDelayBlast = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/GenericDelayBlast.prefab").WaitForCompletion();

		private static GameObject magmaOrb = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/MagmaWorm/MagmaOrbExplosion.prefab").WaitForCompletion();

		public static float entryDuration = 1.5f;

		public static float fireDuration = 0.1f;

		public static float exitDuration = 0.15f;

		public static float maxDistance = 128f;

		public static float trackingDuration = 0.85f;

		public static float pillarDamageCoefficient = 6f;

		public static float pillarForce = 1000f;

		public static float pillarVerticalForce = 500f;

		public static float pillarRadius = 5f;

		public static float pillarDelay = 1.3f;

		private bool hasShownPrediction;

		private bool predictionOk;

		protected Vector3 predictedTargetPosition;

		private AimAnimator aimAnimator;

		private GameObject chargeInstance;

		private float stopwatch;

		private SubState subState;

		private Predictor predictor;

		private static GameObject predictionEffect => Assets.flamePillarPredictionEffect;

		public override void OnEnter()
		{
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0227: Expected O, but got Unknown
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			((BaseState)this).OnEnter();
			stopwatch = 0f;
			if (Object.op_Implicit((Object)(object)((EntityState)this).modelLocator))
			{
				ChildLocator component = ((Component)((EntityState)this).modelLocator.modelTransform).GetComponent<ChildLocator>();
				aimAnimator = ((Component)((EntityState)this).modelLocator.modelTransform).GetComponent<AimAnimator>();
				if (Object.op_Implicit((Object)(object)aimAnimator))
				{
					((Behaviour)aimAnimator).enabled = true;
				}
				if (Object.op_Implicit((Object)(object)component))
				{
					Transform modelTransform = ((EntityState)this).GetModelTransform();
					if (Object.op_Implicit((Object)(object)modelTransform))
					{
						CharacterModel component2 = ((Component)modelTransform).gameObject.GetComponent<CharacterModel>();
						if (Object.op_Implicit((Object)(object)component2))
						{
							if (component2.temporaryOverlays == null)
							{
								component2.temporaryOverlays = new List<TemporaryOverlayInstance>();
							}
							TemporaryOverlayInstance val = TemporaryOverlayManager.AddOverlay(((Component)component2).gameObject);
							val.duration = 3f;
							val.animateShaderAlpha = true;
							val.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
							val.destroyComponentOnEnd = true;
							val.originalMaterial = onFireMat;
							val.inspectorCharacterModel = component2;
							val.Start();
						}
					}
					Transform val2 = component.FindChild("MuzzleMouth");
					if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)ChargeMegaFireball.chargeEffectPrefab))
					{
						chargeInstance = Object.Instantiate<GameObject>(ChargeMegaFireball.chargeEffectPrefab, val2.position, val2.rotation);
						chargeInstance.transform.parent = val2;
						ScaleParticleSystemDuration component3 = chargeInstance.GetComponent<ScaleParticleSystemDuration>();
						if (Object.op_Implicit((Object)(object)component3))
						{
							component3.newDuration = 0.5f;
						}
					}
				}
			}
			((EntityState)this).PlayAnimation("Gesture, Override", "PrepFlamebreath", "PrepFlamebreath.playbackRate", entryDuration, 0f);
			subState = SubState.Prep;
			Util.PlaySound("sfx_direseeker_woosh", ((EntityState)this).gameObject);
			if (NetworkServer.active)
			{
				BullseyeSearch val3 = new BullseyeSearch();
				val3.teamMaskFilter = TeamMask.allButNeutral;
				if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent))
				{
					((TeamMask)(ref val3.teamMaskFilter)).RemoveTeam(((EntityState)this).teamComponent.teamIndex);
				}
				val3.maxDistanceFilter = maxDistance;
				val3.maxAngleFilter = 90f;
				Ray aimRay = ((BaseState)this).GetAimRay();
				val3.searchOrigin = ((Ray)(ref aimRay)).origin;
				val3.searchDirection = ((Ray)(ref aimRay)).direction;
				val3.filterByLoS = false;
				val3.sortMode = (SortMode)2;
				val3.RefreshCandidates();
				HurtBox val4 = val3.GetResults().FirstOrDefault();
				if (Object.op_Implicit((Object)(object)val4))
				{
					predictor = new Predictor(((EntityState)this).transform);
					predictor.SetTargetTransform(((Component)val4).transform);
				}
			}
		}

		public override void OnExit()
		{
			((EntityState)this).OnExit();
			if (Object.op_Implicit((Object)(object)chargeInstance))
			{
				EntityState.Destroy((Object)(object)chargeInstance);
			}
			((EntityState)this).PlayCrossfade("Gesture, Override", "BufferEmpty", 0.1f);
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			stopwatch += ((EntityState)this).GetDeltaTime();
			switch (subState)
			{
			case SubState.Prep:
				if (predictor != null)
				{
					predictor.Update();
				}
				if (stopwatch <= trackingDuration)
				{
					if (predictor != null)
					{
						predictionOk = predictor.GetPredictedTargetPosition(pillarDelay, out predictedTargetPosition);
					}
				}
				else if (!hasShownPrediction)
				{
					hasShownPrediction = true;
					PlacePredictedAttack();
				}
				if (stopwatch >= entryDuration)
				{
					predictor = null;
					subState = SubState.FirePillar;
					stopwatch = 0f;
					((EntityState)this).PlayAnimation("Gesture, Override", "Flamebreath", "Flamebreath.playbackRate", entryDuration, 0f);
					if (Object.op_Implicit((Object)(object)chargeInstance))
					{
						EntityState.Destroy((Object)(object)chargeInstance);
					}
				}
				break;
			case SubState.FirePillar:
				if (stopwatch >= fireDuration)
				{
					subState = SubState.Exit;
					stopwatch = 0f;
				}
				break;
			case SubState.Exit:
				if (stopwatch >= exitDuration)
				{
					((EntityState)this).PlayCrossfade("Gesture, Override", "ExitFlamebreath", "ExitFlamebreath.playbackRate", fireDuration, 0.1f);
					if (((EntityState)this).isAuthority)
					{
						((EntityState)this).outer.SetNextStateToMain();
					}
				}
				break;
			}
		}

		protected virtual void PlacePredictedAttack()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			PlaceSingleDelayBlast(predictedTargetPosition, 0f);
		}

		protected void PlaceSingleDelayBlast(Vector3 position, float delay)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: 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)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			EffectManager.SpawnEffect(predictionEffect, new EffectData
			{
				origin = position,
				scale = pillarRadius,
				rotation = Quaternion.identity
			}, true);
			GameObject val = Object.Instantiate<GameObject>(genericDelayBlast, position, Quaternion.identity);
			DelayBlast component = val.GetComponent<DelayBlast>();
			component.position = position;
			component.baseDamage = base.damageStat * pillarDamageCoefficient;
			component.baseForce = pillarForce;
			component.bonusForce = pillarVerticalForce * Vector3.up;
			component.attacker = ((EntityState)this).gameObject;
			component.radius = pillarRadius;
			component.crit = ((BaseState)this).RollCrit();
			component.maxTimer = entryDuration - trackingDuration + delay;
			component.falloffModel = (FalloffModel)0;
			component.explosionEffect = magmaOrb;
			component.maxTimer = pillarDelay;
			component.damageType.damageSource = (DamageSource)4;
			val.GetComponent<TeamFilter>().teamIndex = TeamComponent.GetObjectTeam(component.attacker);
		}
	}
	public class FlamePillars : FlamePillar
	{
		protected override void PlacePredictedAttack()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: 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)
			RaycastHit val4 = default(RaycastHit);
			for (int i = 0; i < 2; i++)
			{
				int num = 0;
				Vector3 val = predictedTargetPosition;
				Vector3 val2 = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f) * Vector3.forward;
				for (int j = -(2 * FireGoldFist.fistCount / 2); j < 2 * FireGoldFist.fistCount / 2; j++)
				{
					Vector3 val3 = val + val2 * FireGoldFist.distanceBetweenFists * (float)j;
					float num2 = 60f;
					if (Physics.Raycast(new Ray(val3 + Vector3.up * (num2 / 2f), Vector3.down), ref val4, num2, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
					{
						val3 = ((RaycastHit)(ref val4)).point;
					}
					PlaceSingleDelayBlast(val3, FireGoldFist.delayBetweenFists * (float)num);
					num++;
				}
			}
		}
	}
	public class Flamethrower : BaseState
	{
		private float lastUpdateTime;

		public static GameObject flamethrowerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Lemurian/FlamebreathEffect.prefab").WaitForCompletion();

		public static float baseEntryDuration = 0.5f;

		public static float baseExitDuration = 0.75f;

		public static float baseFlamethrowerDuration = 2.25f;

		private float tickDamageCoefficient;

		private float flamethrowerStopwatch;

		private float stopwatch;

		private float entryDuration;

		private float exitDuration;

		private float flamethrowerDuration;

		private bool hasBegunFlamethrower;

		private ChildLocator childLocator;

		private Transform flamethrowerEffectInstance;

		private Transform secondaryFlamethrowerEffectInstance;

		private Transform muzzleTransform;

		private bool isCrit;

		private const float flamethrowerEffectBaseDistance = 16f;

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			lastUpdateTime = Time.time;
			stopwatch = 0f;
			entryDuration = baseEntryDuration / base.attackSpeedStat;
			exitDuration = baseExitDuration / base.attackSpeedStat;
			flamethrowerDuration = baseFlamethrowerDuration;
			Transform modelTransform = ((EntityState)this).GetModelTransform();
			if (Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				((EntityState)this).characterBody.SetAimTimer(entryDuration + flamethrowerDuration + 1f);
			}
			if (Object.op_Implicit((Object)(object)modelTransform))
			{
				childLocator = ((Component)modelTransform).GetComponent<ChildLocator>();
				((Behaviour)((Component)modelTransform).GetComponent<AimAnimator>()).enabled = true;
			}
			float num = flamethrowerDuration * Flamebreath.tickFrequency;
			tickDamageCoefficient = Flamebreath.totalDamageCoefficient / num;
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterBody))
			{
				isCrit = Util.CheckRoll(base.critStat, ((EntityState)this).characterBody.master);
			}
			((EntityState)this).PlayAnimation("Gesture, Override", "PrepFlamebreath", "PrepFlamebreath.playbackRate", entryDuration, 0f);
		}

		public override void OnExit()
		{
			Util.PlaySound(Flamebreath.endAttackSoundString, ((EntityState)this).gameObject);
			((EntityState)this).PlayCrossfade("Gesture, Override", "BufferEmpty", 0.1f);
			if (Object.op_Implicit((Object)(object)flamethrowerEffectInstance))
			{
				EntityState.Destroy((Object)(object)((Component)flamethrowerEffectInstance).gameObject);
			}
			if (Object.op_Implicit((Object)(object)secondaryFlamethrowerEffectInstance))
			{
				EntityState.Destroy((Object)(object)((Component)secondaryFlamethrowerEffectInstance).gameObject);
			}
			((EntityState)this).OnExit();
		}

		private void FireFlame(string muzzleString)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)muzzleTransform))
			{
				BulletAttack val = new BulletAttack
				{
					owner = ((EntityState)this).gameObject,
					weapon = ((EntityState)this).gameObject,
					origin = muzzleTransform.position,
					aimVector = muzzleTransform.forward,
					minSpread = 0f,
					maxSpread = Flamebreath.maxSpread,
					damage = tickDamageCoefficient * base.damageStat,
					force = Flamebreath.force,
					muzzleName = muzzleString,
					hitEffectPrefab = Flamebreath.impactEffectPrefab,
					isCrit = isCrit,
					radius = Flamebreath.radius * 3f,
					falloffModel = (FalloffModel)0,
					stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask,
					procCoefficient = Flamebreath.procCoefficientPerTick,
					maxDistance = Flamebreath.maxDistance,
					smartCollision = true,
					damageType = DamageTypeCombo.op_Implicit((DamageType)8192)
				};
				val.damageType.damageSource = (DamageSource)2;
				val.Fire();
			}
		}

		public override void FixedUpdate()
		{
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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)
			((EntityState)this).FixedUpdate();
			float num = Time.time - lastUpdateTime;
			lastUpdateTime = Time.time;
			stopwatch += num;
			if (stopwatch >= entryDuration && stopwatch < entryDuration + flamethrowerDuration && !hasBegunFlamethrower)
			{
				hasBegunFlamethrower = true;
				Util.PlaySound(Flamebreath.startAttackSoundString, ((EntityState)this).gameObject);
				((EntityState)this).PlayAnimation("Gesture, Override", "Flamebreath", "Flamebreath.playbackRate", flamethrowerDuration, 0f);
				if (Object.op_Implicit((Object)(object)childLocator))
				{
					muzzleTransform = childLocator.FindChild("MuzzleMouth");
					if (Object.op_Implicit((Object)(object)Flamebreath.flamethrowerEffectPrefab))
					{
						flamethrowerEffectInstance = Object.Instantiate<GameObject>(Flamebreath.flamethrowerEffectPrefab, muzzleTransform).transform;
						((Component)flamethrowerEffectInstance).transform.localPosition = Vector3.zero;
						((Component)flamethrowerEffectInstance).GetComponent<ScaleParticleSystemDuration>().newDuration = flamethrowerDuration;
					}
					if (Object.op_Implicit((Object)(object)flamethrowerEffectPrefab))
					{
						secondaryFlamethrowerEffectInstance = Object.Instantiate<GameObject>(flamethrowerEffectPrefab, muzzleTransform).transform;
						Transform transform = ((Component)secondaryFlamethrowerEffectInstance).transform;
						transform.localScale *= 1.25f;
						((Component)secondaryFlamethrowerEffectInstance).transform.localPosition = Vector3.zero;
						((Component)secondaryFlamethrowerEffectInstance).GetComponent<ScaleParticleSystemDuration>().newDuration = flamethrowerDuration;
					}
				}
			}
			if (stopwatch >= entryDuration + flamethrowerDuration && hasBegunFlamethrower)
			{
				hasBegunFlamethrower = false;
				((EntityState)this).PlayCrossfade("Gesture, Override", "ExitFlamebreath", "ExitFlamebreath.playbackRate", exitDuration, 0.1f);
			}
			if (hasBegunFlamethrower)
			{
				flamethrowerStopwatch += num;
				if (flamethrowerStopwatch > 1f / Flamebreath.tickFrequency)
				{
					flamethrowerStopwatch -= 1f / Flamebreath.tickFrequency;
					FireFlame("MuzzleCenter");
				}
			}
			else if (Object.op_Implicit((Object)(object)flamethrowerEffectInstance))
			{
				EntityState.Destroy((Object)(object)((Component)flamethrowerEffectInstance).gameObject);
			}
			if (stopwatch >= flamethrowerDuration + entryDuration + exitDuration && ((EntityState)this).isAuthority)
			{
				((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;
		}
	}
	public class SpawnState : EntityState
	{
		private float lastUpdateTime;

		public static float duration = 2.5f;

		private float effectStopwatch;

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			lastUpdateTime = Time.time;
			((EntityState)this).GetModelAnimator();
			Util.PlaySound(SpawnState.spawnSoundString, ((EntityState)this).gameObject);
			Util.PlaySound("sfx_direseeker_spawn", ((EntityState)this).gameObject);
			((EntityState)this).PlayAnimation("Body", "Spawn", "Spawn.playbackRate", duration, 0f);
			EffectManager.SimpleMuzzleFlash(SpawnState.spawnEffectPrefab, ((EntityState)this).gameObject, "SpawnEffectOrigin", false);
			effectStopwatch = 0.7f;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			float num = Time.time - lastUpdateTime;
			lastUpdateTime = Time.time;
			effectStopwatch -= num;
			if ((effectStopwatch <= 0f) & (((EntityState)this).fixedAge < 0.5f * duration))
			{
				PlaySpawnEffect();
			}
			if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
			{
				base.outer.SetNextStateToMain();
			}
		}

		private void PlaySpawnEffect()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			effectStopwatch = 0.1f;
			for (int i = 0; i <= 5; i++)
			{
				Vector3 origin = ((EntityState)this).characterBody.footPosition + Random.insideUnitSphere * 22f;
				origin.y = ((EntityState)this).characterBody.footPosition.y;
				EffectManager.SpawnEffect(SpawnState.spawnEffectPrefab, new EffectData
				{
					origin = origin,
					scale = 4f
				}, true);
			}
		}

		public override InterruptPriority GetMinimumInterruptPriority()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return (InterruptPriority)9;
		}
	}
}
namespace DireseekerMod.States.Sun
{
	public abstract class SunBase : BaseState
	{
		protected DireseekerSunController sunController { get; private set; }

		protected Transform vfxRoot { get; private set; }

		protected virtual bool shouldEnableSunController => false;

		public virtual bool shouldSpawnEffect => true;

		protected abstract float desiredVfxScale { get; }

		public override void OnEnter()
		{
			((BaseState)this).OnEnter();
			sunController = ((EntityState)this).GetComponent<DireseekerSunController>();
			((Behaviour)sunController).enabled = shouldEnableSunController;
			vfxRoot = ((EntityState)this).transform.Find("VfxRoot");
			SetVfxScale(desiredVfxScale);
		}

		public override void Update()
		{
			((EntityState)this).Update();
			SetVfxScale(desiredVfxScale);
		}

		private void SetVfxScale(float newScale)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			newScale = Mathf.Max(newScale, 0.01f);
			if (Object.op_Implicit((Object)(object)vfxRoot) && ((Component)vfxRoot).transform.localScale.x != newScale)
			{
				((Component)vfxRoot).transform.localScale = new Vector3(newScale, newScale, newScale);
			}
		}
	}
	public class SunDeath : SunBase
	{
		public static float baseDuration;

		private float duration;

		public override bool shouldSpawnEffect => false;

		protected override float desiredVfxScale => 1f - Mathf.Clamp01(((EntityState)this).age / duration);

		public override void OnEnter()
		{
			base.OnEnter();
			duration = baseDuration;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (NetworkServer.active && ((EntityState)this).fixedAge >= duration)
			{
				NetworkServer.Destroy(((EntityState)this).gameObject);
			}
		}
	}
	public class SunMain : SunBase
	{
		private GenericOwnership ownership;

		protected override bool shouldEnableSunController => true;

		public override bool shouldSpawnEffect => false;

		protected override float desiredVfxScale => 1f;

		public override void OnEnter()
		{
			base.OnEnter();
			ownership = ((EntityState)this).GetComponent<GenericOwnership>();
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && !Object.op_Implicit((Object)(object)ownership.ownerObject))
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new SunDeath());
			}
		}
	}
	public class SunSpawn : SunBase
	{
		public static float baseDuration = 0.6f;

		private float duration;

		protected override float desiredVfxScale => Mathf.Clamp01(((EntityState)this).age / duration);

		public override void OnEnter()
		{
			base.OnEnter();
			duration = baseDuration;
		}

		public override void FixedUpdate()
		{
			((EntityState)this).FixedUpdate();
			if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= duration)
			{
				((EntityState)this).outer.SetNextState((EntityState)(object)new SunMain());
			}
		}
	}
}
namespace DireseekerMod.States.Missions.DireseekerEncounter
{
	public class Listening : EntityState
	{
		public static float delayBeforeBeginningEncounter = 3f;

		public static int buttonsPressedToTriggerEncounter = 4;

		private ScriptedCombatEncounter scriptedCombatEncounter;

		private List<DireseekerButtonController> buttonList = new List<DireseekerButtonController>();

		private const float delayBeforeRegisteringButtons = 2f;

		private bool hasRegisteredButtons;

		private int previousPressedButtonCount;

		private bool beginEncounterCountdown;

		private float encounterCountdown;

		public override void OnEnter()
		{
			((EntityState)this).OnEnter();
			scriptedCombatEncounter = ((EntityState)this).GetComponent<ScriptedCombatEncounter>();
		}

		public override void FixedUpdate()
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Expected O, but got Unknown
			((EntityState)this).FixedUpdate();
			if (!NetworkServer.active)
			{
				return;
			}
			if (((EntityState)this).fixedAge >= 2f)
			{
				RegisterButtons();
			}
			if (!hasRegisteredButtons)
			{
				return;
			}
			int num = 0;
			for (int i = 0; i < buttonList.Count; i++)
			{
				if (buttonList[i].isPressedServer)
				{
					num++;
				}
			}
			int num2 = buttonsPressedToTriggerEncounter - 1;
			if (previousPressedButtonCount < num2 && num >= num2)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "DIRESEEKER_SPAWN_WARNING"
				});
			}
			if (num >= buttonsPressedToTriggerEncounter && !beginEncounterCountdown)
			{
				encounterCountdown = delayBeforeBeginningEncounter;
				beginEncounterCountdown = true;
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "DIRESEEKER_SPAWN_BEGIN"
				});
			}
			if (beginEncounterCountdown)
			{
				encounterCountdown -= Time.fixedDeltaTime;
				if (encounterCountdown <= 0f)
				{
					scriptedCombatEncounter.BeginEncounter();
					base.outer.SetNextState((EntityState)new Idle());
				}
			}
			previousPressedButtonCount = num;
		}

		private void RegisterButtons()
		{
			if (!hasRegisteredButtons)
			{
				DireseekerButtonController[] array = Object.FindObjectsOfType<DireseekerButtonController>();
				foreach (DireseekerButtonController item in array)
				{
					buttonList.Add(item);
				}
				hasRegisteredButtons = true;
			}
		}
	}
}
namespace DireseekerMod.Modules
{
	public static class Assets
	{
		public static GameObject roarEffect;

		public static GameObject sunPrefab;

		public static AssetBundle mainAssetBundle;

		public static AssetBundle altAssetBundle;

		public static Texture bossPortrait;

		public static Texture charPortrait;

		public static GameObject flamePillarPredictionEffect;

		public static GameObject direseekerEncounter;

		public static GameObject direseekerButton;

		public static void PopulateAssets()
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0393: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0489: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_0506: Unknown result type (might be due to invalid IL or missing references)
			//IL_0510: Unknown result type (might be due to invalid IL or missing references)
			//IL_0534: Unknown result type (might be due to invalid IL or missing references)
			//IL_053e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0585: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)mainAssetBundle == (Object)null)
			{
				using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Direseeker.direseeker");
				mainAssetBundle = AssetBundle.LoadFromStream(stream);
			}
			if ((Object)(object)altAssetBundle == (Object)null)
			{
				using Stream stream2 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Direseeker.direseeker2");
				altAssetBundle = AssetBundle.LoadFromStream(stream2);
			}
			using (Stream stream3 = Assembly.GetExecutingAssembly().GetManifestResourceStream("Direseeker.direseeker_bank2.bnk"))
			{
				byte[] array = new byte[stream3.Length];
				stream3.Read(array, 0, array.Length);
				SoundBanks.Add(array);
			}
			bossPortrait = (Texture)(object)altAssetBundle.LoadAsset<Sprite>("texDireseekerIcon").texture;
			charPortrait = (Texture)(object)mainAssetBundle.LoadAsset<Sprite>("texDireseekerPlayerIcon").texture;
			direseekerEncounter = mainAssetBundle.LoadAsset<GameObject>("BossEncounter");
			direseekerEncounter.AddComponent<NetworkIdentity>();
			PrefabAPI.RegisterNetworkPrefab(direseekerEncounter);
			direseekerButton = mainAssetBundle.LoadAsset<GameObject>("DireseekerButton");
			Shader shader = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion();
			Material material = ((Renderer)direseekerButton.GetComponentInChildren<SkinnedMeshRenderer>()).material;
			material.shader = shader;
			direseekerButton.AddComponent<DireseekerButtonController>();
			direseekerButton.AddComponent<NetworkIdentity>();
			PrefabAPI.RegisterNetworkPrefab(direseekerButton);
			roarEffect = altAssetBundle.LoadAsset<GameObject>("DireseekerRoar");
			((Renderer)((Component)roarEffect.transform.Find("Nova")).GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/matTeamAreaIndicatorFullMonster.mat").WaitForCompletion();
			((Renderer)((Component)roarEffect.transform.Find("Distortion")).GetComponent<ParticleSystemRenderer>()).material = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Common/VFX/matDistortion.mat").WaitForCompletion();
			GameObject gameObject = ((Component)roarEffect.transform.Find("PP")).gameObject;
			gameObject.layer = 20;
			PostProcessVolume val = gameObject.AddComponent<PostProcessVolume>();
			val.sharedProfile = Addressables.LoadAssetAsync<PostProcessProfile>((object)"RoR2/GlobalContent/ppLocalBlur.asset").WaitForCompletion();
			val.blendDistance = 120f;
			val.priority = 6f;
			val.weight = 1f;
			val.isGlobal = false;
			PostProcessDuration val2 = gameObject.AddComponent<PostProcessDuration>();
			val2.ppVolume = val;
			val2.ppWeightCurve = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ImpBoss/ImpBossBlink.prefab").WaitForCompletion().GetComponentInChildren<PostProcessDuration>()
				.ppWeightCurve;
			val2.maxDuration = 5f;
			val2.destroyOnEnd = true;
			SphereCollider val3 = gameObject.AddComponent<SphereCollider>();
			((Collider)val3).contactOffset = 0.01f;
			((Collider)val3).isTrigger = true;
			val3.radius = 120f;
			flamePillarPredictionEffect = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Items/MeteorAttackOnHighDamage/RunicMeteorStrikePredictionEffect.prefab").WaitForCompletion(), "DireseekerPredictionEffect", true);
			flamePillarPredictionEffect.GetComponent<DestroyOnTimer>().duration = FlamePillar.pillarDelay;
			AnimateShaderAlpha[] componentsInChildren = flamePillarPredictionEffect.GetComponentsInChildren<AnimateShaderAlpha>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				componentsInChildren[i].timeMax = FlamePillar.pillarDelay;
			}
			ObjectScaleCurve[] componentsInChildren2 = flamePillarPredictionEffect.GetComponentsInChildren<ObjectScaleCurve>(true);
			for (int j = 0; j < componentsInChildren2.Length; j++)
			{
				componentsInChildren2[j].timeMax = FlamePillar.pillarDelay;
			}
			ContentAddition.AddEffect(flamePillarPredictionEffect);
			sunPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Grandparent/GrandParentSun.prefab").WaitForCompletion(), "DireseekerSun", true);
			DireseekerSunController direseekerSunController = sunPrefab.AddComponent<DireseekerSunController>();
			GrandParentSunController component = sunPrefab.GetComponent<GrandParentSunController>();
			direseekerSunController.buffApplyEffect = component.buffApplyEffect;
			direseekerSunController.buffDef = component.buffDef;
			direseekerSunController.activeLoopDef = component.activeLoopDef;
			direseekerSunController.damageLoopDef = component.damageLoopDef;
			direseekerSunController.stopSoundName = component.stopSoundName;
			Object.DestroyImmediate((Object)(object)component);
			sunPrefab.AddComponent<DireseekerSunNetworkController>();
			Object.DestroyImmediate((Object)(object)sunPrefab.GetComponent<EntityStateMachine>());
			sunPrefab.AddComponent<EntityStateMachine>();
			EntityStateMachine component2 = sunPrefab.GetComponent<EntityStateMachine>();
			((Object)component2).name = "Body";
			component2.initialStateType = new SerializableEntityStateType(typeof(SunSpawn));
			sunPrefab.GetComponent<NetworkStateMachine>().stateMachines[0] = component2;
			sunPrefab.transform.localScale = Vector3.one * 1f;
			Light component3 = ((Component)sunPrefab.transform.Find("VfxRoot/LightSpinner/LightSpinner/Point Light")).GetComponent<Light>();
			component3.intensity *= 0.1f;
			((Component)sunPrefab.transform.Find("VfxRoot/LightSpinner/LightSpinner/Point Light")).GetComponent<Light>().range = 200f;
			((Component)sunPrefab.transform.Find("VfxRoot/Mesh/SunMesh")).transform.localScale = Vector3.one * 1f;
			((Component)sunPrefab.transform.Find("VfxRoot/Mesh/AreaIndicator")).transform.localScale = Vector3.one * 180f;
			Object.DestroyImmediate((Object)(object)((Component)sunPrefab.transform.Find("VfxRoot/Mesh/SunMesh/MoonMesh")).gameObject);
			ParticleSystem component4 = ((Component)sunPrefab.transform.Find("VfxRoot/Particles/Sparks")).GetComponent<ParticleSystem>();
			EmissionModule emission = component4.emission;
			((EmissionModule)(ref emission)).enabled = false;
			ParticleSystem component5 = ((Component)sunPrefab.transform.Find("VfxRoot/Particles/Goo, Drip")).GetComponent<ParticleSystem>();
			EmissionModule emission2 = component5.emission;
			((EmissionModule)(ref emission2)).enabled = false;
		}

		public static void UpdateAssets()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)direseekerEncounter.transform.GetChild(0)).gameObject;
			gameObject.AddComponent<NetworkIdentity>();
			PrefabAPI.RegisterNetworkPrefab(gameObject);
			ScriptedCombatEncounter val = gameObject.AddComponent<ScriptedCombatEncounter>();
			direseekerEncounter.transform.GetChild(0).GetChild(1).Translate(0f, 1f, 0f);
			val.spawns = (SpawnInfo[])(object)new SpawnInfo[1]
			{
				new SpawnInfo
				{
					explicitSpawnPosition = direseekerEncounter.transform.GetChild(0).GetChild(0),
					spawnCard = (SpawnCard)(object)SpawnCards.bossSpawnCard
				}
			};
			val.randomizeSeed = false;
			val.teamIndex = (TeamIndex)2;
			val.spawnOnStart = false;
			val.grantUniqueBonusScaling = true;
			BossGroup val2 = gameObject.AddComponent<BossGroup>();
			val2.bossDropChance = 1f;
			val2.dropPosition = direseekerEncounter.transform.GetChild(0).GetChild(1);
			val2.forceTier3Reward = true;
			val2.scaleRewardsByPlayerCount = true;
			val2.shouldDisplayHealthBarOnHud = true;
			CombatSquad val3 = gameObject.AddComponent<CombatSquad>();
			EntityStateMachine val4 = gameObject.AddComponent<EntityStateMachine>();
			val4.initialStateType = new SerializableEntityStateType(typeof(Listening));
			val4.mainStateType = new SerializableEntityStateType(typeof(Listening));
		}

		private static GameObject LoadEffect(string resourceName, string soundName)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName);
			val.AddComponent<DestroyOnTimer>().duration = 12f;
			val.AddComponent<NetworkIdentity>();
			val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
			EffectComponent val2 = val.AddComponent<EffectComponent>();
			val2.applyScale = false;
			val2.effectIndex = (EffectIndex)(-1);
			val2.parentToReferencedTransform = true;
			val2.positionAtReferencedTransform = true;
			val2.soundName = soundName;
			ContentAddition.AddEffect(val);
			return val;
		}
	}
	public class Hooks
	{
		public Vector3[] buttonPosition;

		public Vector3[] buttonRotation;

		private void InitButtonPositions()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			buttonPosition = (Vector3[])(object)new Vector3[7]
			{
				new Vector3(2f, -140.5f, -439f),
				new Vector3(110f, -179.2f, -150f),
				new Vector3(203f, -75f, -195.5f),
				new Vector3(51f, -86f, -200.6f),
				new Vector3(-154f, -153f, -103.6f),
				new Vector3(-0.5f, -135.5f, -12.5f),
				new Vector3(-37.5f, -127f, -287.8f)
			};
			buttonRotation = (Vector3[])(object)new Vector3[7]
			{
				new Vector3(0f, 60f, 5f),
				new Vector3(0f, 45f, 0f),
				new Vector3(290f, 340f, 0f),
				new Vector3(270f, 0f, 0f),
				new Vector3(270f, 0f, 0f),
				new Vector3(0f, 0f, 0f),
				new Vector3(0f, 90f, 110f)
			};
		}

		public void ApplyHooks()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			InitButtonPositions();
			SceneDirector.Start += (hook_Start)delegate(orig_Start orig, SceneDirector self)
			{
				//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_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0086: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Unknown result type (might be due to invalid IL or missing references)
				if (NetworkServer.active)
				{
					Scene activeScene = SceneManager.GetActiveScene();
					if (((Scene)(ref activeScene)).name == "dampcavesimple")
					{
						Object.Destroy((Object)(object)((Component)GameObject.Find("HOLDER: Newt Statues and Preplaced Chests").transform.Find("GoldChest")).gameObject);
						for (int i = 0; i < buttonPosition.Length; i++)
						{
							GameObject val = Object.Instantiate<GameObject>(Assets.direseekerButton);
							val.transform.position = buttonPosition[i];
							val.transform.rotation = Quaternion.Euler(buttonRotation[i]);
							NetworkServer.Spawn(val);
						}
						GameObject val2 = Object.Instantiate<GameObject>(Assets.direseekerEncounter);
						NetworkServer.Spawn(val2);
					}
				}
				orig.Invoke(self);
			};
		}
	}
	public static class Prefabs
	{
		public static GameObject direseekerBodyPrefab;

		public static GameObject masterPrefab;

		public static void CreatePrefab()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_0427: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_044d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Expected O, but got Unknown
			//IL_0535: Unknown result type (might be due to invalid IL or missing references)
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0558: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0611: Unknown result type (might be due to invalid IL or missing references)
			//IL_0613: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_063b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_064a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0692: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			direseekerBodyPrefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LemurianBruiser/LemurianBruiserBody.prefab").WaitForCompletion(), "DireseekerBody", true);
			Rigidbody component = direseekerBodyPrefab.GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.mass = 900f;
			}
			Object.Destroy((Object)(object)direseekerBodyPrefab.GetComponent<SetStateOnHurt>());
			CharacterBody component2 = direseekerBodyPrefab.GetComponent<CharacterBody>();
			((Object)component2).name = "DireseekerBossBody";
			component2.baseNameToken = "DIRESEEKER_BOSS_BODY_NAME";
			component2.subtitleNameToken = "DIRESEEKER_BOSS_BODY_SUBTITLE";
			component2.baseMoveSpeed = 11f;
			component2.baseMaxHealth = 2800f;
			component2.levelMaxHealth = component2.baseMaxHealth * 0.3f;
			component2.baseDamage = 20f;
			component2.levelDamage = component2.baseDamage * 0.2f;
			component2.isChampion = true;
			component2.portraitIcon = Assets.bossPortrait;
			component2.bodyFlags = (BodyFlags)(component2.bodyFlags | 0x80000);
			component2.bodyFlags = (BodyFlags)(component2.bodyFlags | 0x200);
			direseekerBodyPrefab.GetComponent<SfxLocator>().deathSound = "sfx_direseeker_death";
			Transform modelBaseTransform = direseekerBodyPrefab.GetComponent<ModelLocator>().modelBaseTransform;
			modelBaseTransform.localScale *= 1.5f;
			direseekerBodyPrefab.GetComponent<ModelLocator>().modelBaseTransform.localPosition = Vector3.up * -5.5f;
			KinematicCharacterMotor[] componentsInChildren = direseekerBodyPrefab.GetComponentsInChildren<KinematicCharacterMotor>();
			foreach (KinematicCharacterMotor val in componentsInChildren)
			{
				val.SetCapsuleDimensions(val.Capsule.radius * 1.5f, val.Capsule.height * 1.5f, 1.5f);
			}
			GameObject val2 = PrefabAPI.InstantiateClone(Assets.mainAssetBundle.LoadAsset<GameObject>("DireHorn"), "DireseekerHorn", false);
			GameObject val3 = PrefabAPI.InstantiateClone(Assets.mainAssetBundle.LoadAsset<GameObject>("DireHornBroken"), "DireseekerHornBroken", false);
			GameObject val4 = PrefabAPI.InstantiateClone(Assets.mainAssetBundle.LoadAsset<GameObject>("DireseekerRageFlame"), "DireseekerRageFlame", false);
			GameObject val5 = PrefabAPI.InstantiateClone(Assets.mainAssetBundle.LoadAsset<GameObject>("DireseekerBurstFlame"), "DireseekerBurstFlame", false);
			ChildLocator componentInChildren = direseekerBodyPrefab.GetComponentInChildren<ChildLocator>();
			val2.transform.SetParent(componentInChildren.FindChild("Head"));
			val2.transform.localPosition = new Vector3(-2.5f, 1f, -0.5f);
			val2.transform.localRotation = Quaternion.Euler(new Vector3(45f, 0f, 90f));
			val2.transform.localScale = new Vector3(100f, 100f, 100f);
			Shader shader = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion();
			Material material = ((Renderer)val2.GetComponentInChildren<MeshRenderer>()).material;
			material.shader = shader;
			val3.transform.SetParent(componentInChildren.FindChild("Head"));
			val3.transform.localPosition = new Vector3(2.5f, 1f, -0.5f);
			val3.transform.localRotation = Quaternion.Euler(new Vector3(45f, 0f, 90f));
			val3.transform.localScale = new Vector3(100f, -100f, 100f);
			val4.transform.SetParent(componentInChildren.FindChild("Head"));
			val4.transform.localPosition = new Vector3(0f, 1f, 0f);
			val4.transform.localRotation = Quaternion.Euler(new Vector3(270f, 180f, 0f));
			val4.transform.localScale = new Vector3(4f, 4f, 4f);
			val5.transform.SetParent(componentInChildren.FindChild("Head"));
			val5.transform.localPosition = new Vector3(0f, 1f, 0f);
			val5.transform.localRotation = Quaternion.Euler(new Vector3(270f, 180f, 0f));
			val5.transform.localScale = new Vector3(6f, 6f, 6f);
			DireseekerController direseekerController = direseekerBodyPrefab.AddComponent<DireseekerController>();
			direseekerController.burstFlame = val5.GetComponent<ParticleSystem>();
			direseekerController.rageFlame = val4.GetComponent<ParticleSystem>();
			direseekerController.rageFlame.Stop();
			CharacterModel componentInChildren2 = direseekerBodyPrefab.GetComponentInChildren<CharacterModel>();
			((Object)((Component)componentInChildren2).gameObject).name = "mdlDireseeker";
			Material val6 = new Material(Addressables.LoadAssetAsync<Material>((object)RoR2_Base_Lemurian.matLemurianBruiser_mat).WaitForCompletion());
			((Object)val6).name = "matDireseekerMesh";
			val6.SetTexture("_MainTex", Assets.mainAssetBundle.LoadAsset<Material>("matDireseeker").GetTexture("_MainTex"));
			val6.SetTexture("_EmTex", Assets.mainAssetBundle.LoadAsset<Material>("matDireseeker").GetTexture("_EmissionMap"));
			val6.SetFloat("_EmPower", 50f);
			SkinDef val7 = Addressables.LoadAssetAsync<SkinDef>((object)RoR2_Base_LemurianBruiser.skinLemurianBruiserBodyDefault_asset).WaitForCompletion();
			SkinDef val8 = Object.Instantiate<SkinDef>(val7);
			SkinDefParams val9 = Addressables.LoadAssetAsync<SkinDefParams>((object)RoR2_Base_LemurianBruiser_skinLemurianBruiserBodyDefault.params_asset).WaitForCompletion();
			val8.skinDefParams = Object.Instantiate<SkinDefParams>(val9);
			val8.skinDefParamsAddress = new AssetReferenceT<SkinDefParams>("");
			val8.rootObject = ((Component)componentInChildren2).gameObject;
			Renderer component3 = ((Component)((Component)componentInChildren2).transform.Find("LemurianBruiserMesh")).GetComponent<Renderer>();
			RendererInfo[] rendererInfos = (RendererInfo[])(object)new RendererInfo[3]
			{
				new RendererInfo
				{
					renderer