Decompiled source of HalcyonKnight v1.3.1

plugins/HalcyonKnight.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Halcyonite;
using EntityStates.ShrineHalcyonite;
using HG;
using HG.Reflection;
using HalcyonFixes;
using IL.EntityStates.Halcyonite;
using IL.RoR2;
using Logger;
using Md.HalcyonFixes.FixedSlash;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoDetour;
using MonoDetour.Cil;
using MonoDetour.DetourTypes;
using MonoDetour.HookGen;
using MonoMod.Cil;
using On.EntityStates.Halcyonite;
using On.EntityStates.ShrineHalcyonite;
using On.RoR2;
using R2API;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: MonoDetourTargets(typeof(FixedSlash))]
[assembly: IgnoresAccessChecksTo("ItemQualities")]
[assembly: IgnoresAccessChecksTo("ItemQualities.Patcher")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HalcyonKnight")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+1062c8fbe75d05fd80ff60449a42769dbfcaf330")]
[assembly: AssemblyProduct("HalcyonKnight")]
[assembly: AssemblyTitle("HalcyonKnight")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Md.HalcyonFixes.FixedSlash
{
	internal static class get_allowExitFire
	{
		public delegate void PrefixSignature(FixedSlash self);

		public delegate void PostfixSignature(FixedSlash self, ref bool returnValue);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(FixedSlash);
			MethodInfo method = typeFromHandle.GetMethod("get_allowExitFire", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("HalcyonFixes.FixedSlash", "get_allowExitFire");
			}
			return method;
		}
	}
	internal static class OnEnter
	{
		public delegate void PrefixSignature(FixedSlash self);

		public delegate void PostfixSignature(FixedSlash self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(FixedSlash);
			MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("HalcyonFixes.FixedSlash", "OnEnter");
			}
			return method;
		}
	}
	internal static class FixedUpdate
	{
		public delegate void PrefixSignature(FixedSlash self);

		public delegate void PostfixSignature(FixedSlash self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(FixedSlash);
			MethodInfo method = typeFromHandle.GetMethod("FixedUpdate", (BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)method == null)
			{
				throw new MissingMethodException("HalcyonFixes.FixedSlash", "FixedUpdate");
			}
			return method;
		}
	}
	internal static class _ctor
	{
		public delegate void PrefixSignature(FixedSlash self);

		public delegate void PostfixSignature(FixedSlash self);

		public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			Type typeFromHandle = typeof(FixedSlash);
			ConstructorInfo constructor = typeFromHandle.GetConstructor((BindingFlags)(-1), null, Array.Empty<Type>(), null);
			if ((object)constructor == null)
			{
				throw new MissingMethodException("HalcyonFixes.FixedSlash", ".ctor");
			}
			return constructor;
		}
	}
}
namespace MonoDetour.HookGen
{
	internal static class DefaultMonoDetourManager
	{
		internal static MonoDetourManager Instance { get; } = New();

		internal static MonoDetourManager New()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name);
		}
	}
	[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
	internal class MonoDetourTargetsAttribute(Type? targetType = null) : Attribute(), IMonoDetourTargets
	{
		public Type? TargetType { get; } = targetType;

		public bool IncludeNestedTypes { get; set; } = true;

		public string[]? Members { get; set; }

		public string[]? MemberNamePrefixes { get; set; }

		public string[]? MemberNameSuffixes { get; set; }

		public bool GenerateControlFlowVariants { get; set; }
	}
}
namespace Logger
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

		internal static void message(object data)
		{
			_logSource.LogInfo(data);
			if (data != null)
			{
				Chat.AddMessage(data.ToString());
			}
			else
			{
				Chat.AddMessage("Null");
			}
		}

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

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

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

		internal static void Info(object data)
		{
			StackFrame stackFrame = new StackFrame(1);
			MethodBase method = stackFrame.GetMethod();
			_logSource.LogInfo((object)("[" + method.Name + "]: " + data));
		}

		internal static void Message(object data)
		{
			message(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace HalcyonKnight
{
	internal static class AntiFallOff
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_UpdateLand <0>__WhirlWindPersuitCycle_UpdateLand;
		}

		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			AssetReferenceT<GameObject> val = new AssetReferenceT<GameObject>(RoR2_DLC2_Halcyonite.HalcyoniteBody_prefab);
			AsyncOperationHandle<GameObject> val2 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
			val2.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				UnityObjectExtensions.EnsureComponent<ExtraChanges>(x.Result);
			};
			object obj = <>O.<0>__WhirlWindPersuitCycle_UpdateLand;
			if (obj == null)
			{
				hook_UpdateLand val3 = WhirlWindPersuitCycle_UpdateLand;
				<>O.<0>__WhirlWindPersuitCycle_UpdateLand = val3;
				obj = (object)val3;
			}
			WhirlWindPersuitCycle.UpdateLand += (hook_UpdateLand)obj;
		}

		private static void WhirlWindPersuitCycle_UpdateLand(orig_UpdateLand orig, WhirlWindPersuitCycle self)
		{
			//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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			orig.Invoke(self);
			RaycastHit val = default(RaycastHit);
			if (!Physics.Raycast(new Ray(((EntityState)self).transform.position, Vector3.down), ref val, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				((EntityState)self).outer.SetNextState((EntityState)new WhirlwindWarmUp());
			}
		}

		public static void SetStunnable(EntityState self, bool stunnable)
		{
			SetStateOnHurt val = default(SetStateOnHurt);
			ExtraChanges extraChanges = default(ExtraChanges);
			if (self.TryGetComponent<SetStateOnHurt>(ref val) && self.TryGetComponent<ExtraChanges>(ref extraChanges) && extraChanges.stunCooldown <= 0f)
			{
				val.canBeStunned = stunnable;
			}
		}

		public static void SetFreezable(EntityState self, bool freezeable)
		{
			SetStateOnHurt val = default(SetStateOnHurt);
			ExtraChanges extraChanges = default(ExtraChanges);
			if (self.TryGetComponent<SetStateOnHurt>(ref val) && self.TryGetComponent<ExtraChanges>(ref extraChanges) && extraChanges.freezeCooldown <= 0f)
			{
				val.canBeFrozen = freezeable;
			}
		}
	}
	public class ExtraChanges : MonoBehaviour
	{
		private EntityStateMachine _weaponStateMachine;

		private EntityStateMachine _bodyStateMachine;

		private bool _wasStunned;

		private bool _wasFrozen;

		public float stunCooldown;

		public float freezeCooldown;

		public const float maxStunCooldown = 5f;

		public const float maxFreezeCooldown = 5f;

		private void Awake()
		{
			EntityStateMachine[] components = ((Component)this).GetComponents<EntityStateMachine>();
			foreach (EntityStateMachine val in components)
			{
				if (val.customName == "Weapon")
				{
					_weaponStateMachine = val;
				}
				if (val.customName == "Body")
				{
					_bodyStateMachine = val;
				}
			}
		}

		private void FixedUpdate()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)_weaponStateMachine))
			{
				return;
			}
			RaycastHit val = default(RaycastHit);
			bool flag = Physics.Raycast(new Ray(((Component)this).transform.position, Vector3.down), ref val, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1);
			if (!(_weaponStateMachine.state is WhirlwindWarmUp) && !(_weaponStateMachine.state is WhirlWindPersuitCycle) && !(_weaponStateMachine.nextState is WhirlwindWarmUp) && !(_weaponStateMachine.nextState is WhirlWindPersuitCycle) && !flag && _bodyStateMachine.CanInterruptState((InterruptPriority)6))
			{
				_weaponStateMachine.SetInterruptState((EntityState)new WhirlwindWarmUp(), (InterruptPriority)6);
			}
			if (_bodyStateMachine.state is StunState)
			{
				_wasStunned = true;
			}
			else
			{
				if (_wasStunned)
				{
					stunCooldown = 5f;
					Util.PlaySound("Stop_halcyonite_skill3_loop", ((Component)this).gameObject);
					SetStateOnHurt val2 = default(SetStateOnHurt);
					if (((Component)this).TryGetComponent<SetStateOnHurt>(ref val2))
					{
						val2.canBeStunned = false;
					}
				}
				_wasStunned = false;
			}
			if (_bodyStateMachine.state is FrozenState)
			{
				_wasFrozen = true;
			}
			else
			{
				if (_wasFrozen)
				{
					freezeCooldown = 5f;
					Util.PlaySound("Stop_halcyonite_skill3_loop", ((Component)this).gameObject);
					SetStateOnHurt val3 = default(SetStateOnHurt);
					if (((Component)this).TryGetComponent<SetStateOnHurt>(ref val3))
					{
						val3.canBeFrozen = false;
					}
				}
				_wasFrozen = false;
			}
			SetStateOnHurt val4 = default(SetStateOnHurt);
			if (flag && ((Component)this).TryGetComponent<SetStateOnHurt>(ref val4))
			{
				if (stunCooldown > 0f && stunCooldown - Time.fixedDeltaTime <= 0f)
				{
					val4.canBeStunned = true;
				}
				stunCooldown -= Time.fixedDeltaTime;
				if (freezeCooldown > 0f && freezeCooldown - Time.fixedDeltaTime <= 0f)
				{
					val4.canBeFrozen = true;
				}
				freezeCooldown -= Time.fixedDeltaTime;
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("Onyx.HalcyonKnight", "HalcyonKnight", "1.3.1")]
	public sealed class HalcyonKnight : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__TriLaser_FixedUpdate;

			public static hook_OnEnter <1>__TriLaser_OnEnter;

			public static hook_UpdateFindTarget <2>__UpdateFindTarget;
		}

		public const string PluginGUID = "Onyx.HalcyonKnight";

		public const string PluginAuthor = "Onyx";

		public const string PluginName = "HalcyonKnight";

		public const string PluginVersion = "1.3.1";

		public static HalcyonKnight Instance;

		public void Awake()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_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_0146: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//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_02a0: Expected O, but got Unknown
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Expected O, but got Unknown
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			Instance = SingletonHelper.Assign<HalcyonKnight>(Instance, this);
			SwipeHooks.Init();
			AsyncOperationHandle<EntityStateConfiguration> val = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_ChargeTriLaser_asset), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<float>(x.Result, "baseDuration", 1.5f);
			};
			val = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_TriLaser_asset), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<float>(x.Result, "blastRadius", 0.5f);
				Extensions.TryModifyFieldValue<float>(x.Result, "damageCoefficient", 5f);
			};
			val = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_WhirlwindWarmUp_asset), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<float>(x.Result, "duration", 0.7f);
			};
			val = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_WhirlwindPersuitCycle_asset), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<float>(x.Result, "dashSpeedCoefficient", 40f);
				Extensions.TryModifyFieldValue<float>(x.Result, "decelerateDuration", 0.5f);
				Extensions.TryModifyFieldValue<float>(x.Result, "dashSafeExitDuration", 3f);
			};
			val = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_GoldenSwipe_asset), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
			{
				Extensions.TryModifyFieldValue<float>(x.Result, "baseDuration", 1.3f);
			};
			AsyncOperationHandle<GameObject> val2 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC2_Halcyonite.HalcyoniteMaster_prefab), (AsyncReferenceHandleUnloadType)2);
			val2.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				//IL_0191: 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)
				//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_0250: Unknown result type (might be due to invalid IL or missing references)
				//IL_0255: 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_0123: Unknown result type (might be due to invalid IL or missing references)
				GameObject result = x.Result;
				AISkillDriver[] components = result.GetComponents<AISkillDriver>();
				foreach (AISkillDriver val7 in components)
				{
					switch (val7.customName)
					{
					case "Golden Swipe":
						val7.minDistance = 0f;
						val7.movementType = (MovementType)0;
						val7.maxDistance = 15f;
						val7.driverUpdateTimerOverride = 1.5f;
						val7.aimVectorMaxSpeedOverride = 0f;
						break;
					case "Golden Slash":
						val7.movementType = (MovementType)3;
						val7.maxDistance = 10f;
						val7.driverUpdateTimerOverride = 2f;
						break;
					case "TriLaser":
						val7.minDistance = 15f;
						val7.moveInputScale = 0.7f;
						val7.driverUpdateTimerOverride = 2.5f;
						val7.movementType = (MovementType)1;
						break;
					case "WhirlwindRush":
						val7.minDistance = 20f;
						break;
					case "Follow Target":
						val7.minDistance = 5f;
						val7.driverUpdateTimerOverride = 0.5f;
						break;
					case "Follow Nodegraph":
						val7.minDistance = 5f;
						break;
					}
				}
				AISkillDriver val8 = result.AddComponent<AISkillDriver>();
				val8.minDistance = 0f;
				val8.maxDistance = float.MaxValue;
				val8.movementType = (MovementType)3;
				BaseAI val9 = default(BaseAI);
				if (result.TryGetComponent<BaseAI>(ref val9))
				{
					val9.prioritizePlayers = true;
				}
				CombatDirector afterTPDirector = result.AddComponent<CombatDirector>();
				((Behaviour)afterTPDirector).enabled = false;
				afterTPDirector.goldRewardCoefficient = 0f;
				afterTPDirector.moneyWaveIntervals = (RangeFloat[])(object)new RangeFloat[1]
				{
					new RangeFloat
					{
						min = 1f,
						max = 1f
					}
				};
				afterTPDirector.monsterCredit = 150f;
				afterTPDirector.creditMultiplier = 2f;
				HalcAfterTPController halcAfterTPController = result.AddComponent<HalcAfterTPController>();
				halcAfterTPController.combatDirector = afterTPDirector;
				AsyncOperationHandle<DirectorCardCategorySelection> val10 = AssetAsyncReferenceManager<DirectorCardCategorySelection>.LoadAsset(new AssetReferenceT<DirectorCardCategorySelection>(RoR2_DLC2.dccsShrineHalcyoniteActivationMonsterWave_asset), (AsyncReferenceHandleUnloadType)2);
				val10.Completed += delegate(AsyncOperationHandle<DirectorCardCategorySelection> val11)
				{
					afterTPDirector.monsterCards = val11.Result;
				};
			};
			AsyncOperationHandle<SkillDef> val3 = AssetAsyncReferenceManager<SkillDef>.LoadAsset(new AssetReferenceT<SkillDef>(RoR2_DLC2_Halcyonite.HalcyoniteMonsterWhirlwindRush_asset), (AsyncReferenceHandleUnloadType)2);
			val3.Completed += delegate(AsyncOperationHandle<SkillDef> x)
			{
				SkillDef result = x.Result;
				result.baseRechargeInterval = 15f;
			};
			val3 = AssetAsyncReferenceManager<SkillDef>.LoadAsset(new AssetReferenceT<SkillDef>(RoR2_DLC2_Halcyonite.HalcyoniteMonsterGoldenSlash_asset), (AsyncReferenceHandleUnloadType)2);
			val3.Completed += delegate(AsyncOperationHandle<SkillDef> x)
			{
				SkillDef result = x.Result;
				result.baseRechargeInterval = 7f;
			};
			val2 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC2_Halcyonite.HalcyoniteBody_prefab), (AsyncReferenceHandleUnloadType)2);
			val2.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				//IL_0081: 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)
				CharacterBody val7 = default(CharacterBody);
				if (x.Result.TryGetComponent<CharacterBody>(ref val7))
				{
					val7.baseMoveSpeed = 9f;
					val7.subtitleNameToken = "HALCYONITE_BODY_SUBTITLE";
				}
				ModelLocator val8 = default(ModelLocator);
				if (x.Result.TryGetComponent<ModelLocator>(ref val8) && Object.op_Implicit((Object)(object)val8.modelTransform))
				{
					Transform val9 = val8.modelTransform.Find("HitboxGoldenSword");
					if (Object.op_Implicit((Object)(object)val9))
					{
						val9.localScale = new Vector3(2f, 6f, 12f);
					}
					Transform val10 = val8.modelTransform.Find("HitboxGoldenSlash");
					if (Object.op_Implicit((Object)(object)val10))
					{
						val10.localScale = new Vector3(15f, 0.5f, 10f);
					}
				}
				SetStateOnHurt val11 = default(SetStateOnHurt);
				if (x.Result.TryGetComponent<SetStateOnHurt>(ref val11))
				{
					val11.canBeHitStunned = false;
				}
			};
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lang", "Halc.language");
			if (File.Exists(text))
			{
				LanguageAPI.AddOverlayPath(text);
			}
			else
			{
				Log.Error("Failed to find path: " + text);
			}
			object obj = <>O.<0>__TriLaser_FixedUpdate;
			if (obj == null)
			{
				Manipulator val4 = TriLaser_FixedUpdate;
				<>O.<0>__TriLaser_FixedUpdate = val4;
				obj = (object)val4;
			}
			TriLaser.FixedUpdate += (Manipulator)obj;
			object obj2 = <>O.<1>__TriLaser_OnEnter;
			if (obj2 == null)
			{
				hook_OnEnter val5 = TriLaser_OnEnter;
				<>O.<1>__TriLaser_OnEnter = val5;
				obj2 = (object)val5;
			}
			TriLaser.OnEnter += (hook_OnEnter)obj2;
			object obj3 = <>O.<2>__UpdateFindTarget;
			if (obj3 == null)
			{
				hook_UpdateFindTarget val6 = UpdateFindTarget;
				<>O.<2>__UpdateFindTarget = val6;
				obj3 = (object)val6;
			}
			WhirlWindPersuitCycle.UpdateFindTarget += (hook_UpdateFindTarget)obj3;
			TriLaser.FireTriLaser += new hook_FireTriLaser(TriLaser_FireTriLaser);
		}

		private static void UpdateFindTarget(orig_UpdateFindTarget orig, WhirlWindPersuitCycle self)
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: 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)
			if (!Object.op_Implicit((Object)(object)self.targetBody))
			{
				BaseAI[] aiComponents = ((EntityState)self).characterBody.master.AiComponents;
				foreach (BaseAI val in aiComponents)
				{
					if (val.hasAimTarget)
					{
						self.targetBody = val.skillDriverEvaluation.target.characterBody;
						Vector3 footPosition = self.targetBody.footPosition;
						Vector3 val2 = ((EntityState)self).transform.position - self.targetBody.footPosition;
						self.targetPos = footPosition + ((Vector3)(ref val2)).normalized * 2f;
						self.findTargetTimeStamp = ((EntityState)self).fixedAge;
						self.startForwardDirt = ((EntityState)self).characterDirection.forward;
						break;
					}
				}
			}
			orig.Invoke(self);
			RaycastHit val3 = default(RaycastHit);
			if (!Object.op_Implicit((Object)(object)self.targetBody) && Physics.Raycast(new Ray(((EntityState)self).transform.position, Vector3.down), ref val3, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
			{
				((EntityState)self).outer.SetNextStateToMain();
			}
		}

		private static void TriLaser_OnEnter(orig_OnEnter orig, TriLaser self)
		{
			orig.Invoke(self);
			self.targetTimeStamp = 0.1f;
			self.fireCooldown = 0.3f;
		}

		private static void TriLaser_FixedUpdate(ILContext il)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			int num = 0;
			int laserCount = 0;
			while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(TriLaser), "timesFired"),
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref laserCount),
				(Instruction x) => !ILPatternMatchingExt.MatchAdd(x)
			}))
			{
				int index = val.Index;
				val.Index = index - 1;
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<int, TriLaser, int>>((Func<int, TriLaser, int>)MoreLasers);
				num++;
			}
			if (num == 0)
			{
				Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
			}
			static int MoreLasers(int num2, TriLaser self)
			{
				HealthComponent val2 = default(HealthComponent);
				if (((EntityState)self).TryGetComponent<HealthComponent>(ref val2) && val2.health <= val2.fullCombinedHealth / 2f)
				{
					return num2 + 12;
				}
				return num2 + 2;
			}
		}

		private void TriLaser_FireTriLaser(orig_FireTriLaser orig, TriLaser self)
		{
			//IL_0044: 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)
			orig.Invoke(self);
			BaseAI[] aiComponents = ((EntityState)self).characterBody.master.AiComponents;
			foreach (BaseAI val in aiComponents)
			{
				if (val.hasAimTarget)
				{
					if (Vector3.Distance(val.skillDriverEvaluation.target.characterBody.transform.position, ((EntityState)self).transform.position) < 15f)
					{
						((EntityState)self).outer.SetNextStateToMain();
					}
					break;
				}
			}
		}
	}
	public class HalcAfterTPController : MonoBehaviour
	{
		public CombatDirector combatDirector;

		private void Start()
		{
			TeleporterInteraction instance = TeleporterInteraction.instance;
			if (Object.op_Implicit((Object)(object)instance) && instance.isCharged && Object.op_Implicit((Object)(object)combatDirector))
			{
				((Behaviour)combatDirector).enabled = true;
			}
		}
	}
	public static class Shrine
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static Manipulator <0>__DrainConditionMet;

			public static hook_ModifyVisuals <1>__ShrineHalcyoniteBaseState_ModifyVisuals;

			public static Func<HalcyoniteShrineInteractable, int> <2>__AdjustHalcScaling;
		}

		public static SpawnCard halcshrineCard;

		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//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_0044: 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_0081: 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_008c: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Expected O, but got Unknown
			AsyncOperationHandle<GameObject> val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC2.ShrineHalcyonite_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				BossGroup val4 = UnityObjectExtensions.EnsureComponent<BossGroup>(x.Result);
			};
			val = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC2.ShrineHalcyonite_Stage1_Variant_prefab), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				BossGroup val4 = UnityObjectExtensions.EnsureComponent<BossGroup>(x.Result);
			};
			object obj = <>O.<0>__DrainConditionMet;
			if (obj == null)
			{
				Manipulator val2 = DrainConditionMet;
				<>O.<0>__DrainConditionMet = val2;
				obj = (object)val2;
			}
			HalcyoniteShrineInteractable.DrainConditionMet += (Manipulator)obj;
			object obj2 = <>O.<1>__ShrineHalcyoniteBaseState_ModifyVisuals;
			if (obj2 == null)
			{
				hook_ModifyVisuals val3 = ShrineHalcyoniteBaseState_ModifyVisuals;
				<>O.<1>__ShrineHalcyoniteBaseState_ModifyVisuals = val3;
				obj2 = (object)val3;
			}
			ShrineHalcyoniteBaseState.ModifyVisuals += (hook_ModifyVisuals)obj2;
		}

		private static void ShrineHalcyoniteBaseState_ModifyVisuals(orig_ModifyVisuals orig, ShrineHalcyoniteBaseState self)
		{
			orig.Invoke(self);
			if (self.visualsDone)
			{
				self.parentShrineReference.NetworkgoldMaterialModifier = 10f;
			}
		}

		private static void HalcyoniteShrineInteractable_CalculateCredits(orig_CalculateCredits orig, HalcyoniteShrineInteractable self)
		{
			orig.Invoke(self);
			if (self.scaleMonsterCreditWithDifficultyCoefficient)
			{
				self.monsterCredit /= Math.Max(Run.instance.difficultyCoefficient * 0.3f, 1f);
			}
		}

		private static void DrainConditionMet(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_00d6: 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)
			ILCursor val = new ILCursor(il);
			int num = default(int);
			if (val.TryGotoNext(new Func<Instruction, bool>[4]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HalcyoniteShrineInteractable), "goldDrained"),
				(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
				(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num),
				(Instruction x) => ILPatternMatchingExt.MatchDiv(x)
			}) && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
			}))
			{
				val.Emit(OpCodes.Pop);
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<HalcyoniteShrineInteractable, int>>((Func<HalcyoniteShrineInteractable, int>)AdjustHalcScaling);
			}
			else
			{
				Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
			}
			static int AdjustHalcScaling(HalcyoniteShrineInteractable self)
			{
				if (self.goldDrained > self.lowGoldCost && self.goldDrained < self.midGoldCost)
				{
					return (int)(0.7 + 0.06 * (double)Run.instance.ambientLevel);
				}
				if (self.goldDrained > self.midGoldCost && self.goldDrained < self.maxGoldCost)
				{
					return (int)(1.4 + 0.12 * (double)Run.instance.ambientLevel);
				}
				if (self.goldDrained >= self.maxGoldCost)
				{
					return (int)(2.1 + 0.18 * (double)Run.instance.ambientLevel);
				}
				return 0;
			}
		}
	}
	public class SwipeHooks
	{
		public static void Init()
		{
			OnEnter.Postfix(delegate(FixedSlash self)
			{
				//IL_0014: 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_0057: 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)
				HitBoxGroup val = ((BaseState)self).FindHitBoxGroup(((BasicMeleeAttack)self).GetHitBoxGroupName());
				float y = ((EntityState)self).characterBody.footPosition.y;
				HitBox[] hitBoxes = val.hitBoxes;
				foreach (HitBox val2 in hitBoxes)
				{
					((Component)val2).transform.position = new Vector3(((Component)val2).transform.position.x, y + 6f, ((Component)val2).transform.position.z);
				}
			});
			FixedUpdate.Postfix(delegate(FixedSlash self)
			{
				//IL_00ab: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0126: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: Unknown result type (might be due to invalid IL or missing references)
				//IL_014b: 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_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_019e: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
				float? num = null;
				BaseAI[] aiComponents = ((EntityState)self).characterBody.master.AiComponents;
				foreach (BaseAI val in aiComponents)
				{
					if (val.hasAimTarget && val.skillDriverEvaluation.target.characterBody.isPlayerControlled)
					{
						num = val.skillDriverEvaluation.target.characterBody.footPosition.y + 1f;
						break;
					}
				}
				if (!num.HasValue)
				{
					num = float.MinValue;
				}
				else
				{
					float y = ((EntityState)self).characterBody.footPosition.y;
					num = Mathf.Clamp(num.Value, y - 2f, y + 4f);
					HitBox[] hitBoxes = ((BasicMeleeAttack)self).hitBoxGroup.hitBoxes;
					foreach (HitBox val2 in hitBoxes)
					{
						float num2 = ((EntityState)self).transform.position.y - ((EntityState)self).characterBody.previousPosition.y;
						((Component)val2).transform.position = new Vector3(((Component)val2).transform.position.x, ((Component)val2).transform.position.y - num2, ((Component)val2).transform.position.z);
						if (num < ((Component)val2).transform.position.y)
						{
							((Component)val2).transform.position = new Vector3(((Component)val2).transform.position.x, num.Value, ((Component)val2).transform.position.z);
						}
					}
				}
			});
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}