Decompiled source of HalcyonFixes v1.0.0

HalcyonFixes.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Linq;
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 LootPoolLimiter;
using Microsoft.CodeAnalysis;
using On.EntityStates.Halcyonite;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LootPoolLimiter
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

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

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

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

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

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

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

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
}
namespace HalcyonFixes
{
	[BepInPlugin("Onyx.HalcyonFixes", "HalcyonFixes", "1.0.0")]
	public class HalcyonFixes : BaseUnityPlugin
	{
		public class origPersuit : MonoBehaviour
		{
			private bool ran;

			public float fixedAge;

			public void reset()
			{
				fixedAge = 0f;
				ran = false;
			}

			public void OnEnter(WhirlWindPersuitCycle self)
			{
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				if (!ran)
				{
					ran = true;
					Util.PlaySound("Play_halcyonite_skill3_loop", ((Component)this).gameObject);
					((EntityState)self).characterMotor.walkSpeedPenaltyCoefficient = 1f;
					self.state = (PersuitState)1;
					ChildLocator modelChildLocator = ((EntityState)self).GetModelChildLocator();
					if ((Object)(object)WhirlWindPersuitCycle.whirlWindVortexVFXPrefab != (Object)null)
					{
						Transform val = modelChildLocator.FindChild("WhirlWindPoint");
						self.whirlwindVortexInstance = Object.Instantiate<GameObject>(WhirlWindPersuitCycle.whirlWindVortexVFXPrefab, val);
					}
				}
			}

			private void Update()
			{
				fixedAge += Time.deltaTime;
			}
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__4_0;

			public static hook_FixedUpdate <>9__4_2;

			public static hook_CheckIfArrived <>9__4_3;

			public static hook_UpdateDecelerate <>9__4_4;

			public static hook_GetMinimumInterruptPriority <>9__4_6;

			internal void <Awake>b__4_0(orig_OnEnter orig, WhirlwindWarmUp self)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0018: Expected O, but got Unknown
				if (((EntityState)self).isAuthority)
				{
					((EntityState)self).outer.SetNextState((EntityState)new WhirlWindPersuitCycle());
				}
			}

			internal void <Awake>b__4_2(orig_FixedUpdate orig, WhirlWindPersuitCycle self)
			{
				origPersuit component = ((EntityState)self).gameObject.GetComponent<origPersuit>();
				if (!(component.fixedAge < 0.5f))
				{
					component.OnEnter(self);
					orig.Invoke(self);
				}
			}

			internal void <Awake>b__4_3(orig_CheckIfArrived orig, WhirlWindPersuitCycle self)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: 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_0022: Unknown result type (might be due to invalid IL or missing references)
				Ray aimRay = ((BaseState)self).GetAimRay();
				if (Vector3.Dot(((Ray)(ref aimRay)).direction, self.targetMoveDirt) < 0f)
				{
					self.state = (PersuitState)3;
					self.startDecelerateTimeStamp = ((EntityState)self).gameObject.GetComponent<origPersuit>().fixedAge;
					self.startedDash = false;
				}
			}

			internal void <Awake>b__4_4(orig_UpdateDecelerate orig, WhirlWindPersuitCycle self)
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0071: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				if (((EntityState)self).gameObject.GetComponent<origPersuit>().fixedAge > self.startDecelerateTimeStamp + WhirlWindPersuitCycle.decelerateDuration)
				{
					self.state = (PersuitState)4;
				}
				((EntityState)self).characterMotor.velocity = ((Vector3)(ref self.targetMoveDirt)).normalized * WhirlWindPersuitCycle.dashSpeedCoefficient * Mathf.Lerp(1f, 0f, (((EntityState)self).gameObject.GetComponent<origPersuit>().fixedAge - self.startDecelerateTimeStamp) / WhirlWindPersuitCycle.decelerateDuration);
			}

			internal InterruptPriority <Awake>b__4_6(orig_GetMinimumInterruptPriority orig, WhirlWindPersuitCycle self)
			{
				return (InterruptPriority)2;
			}
		}

		public const string PluginGUID = "Onyx.HalcyonFixes";

		public const string PluginAuthor = "Onyx";

		public const string PluginName = "HalcyonFixes";

		public const string PluginVersion = "1.0.0";

		public void Awake()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: 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_002d: 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_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//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_005a: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Expected O, but got Unknown
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Expected O, but got Unknown
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC2/Halcyonite/HalcyoniteMonsterTriLaser.asset").WaitForCompletion().interruptPriority = (InterruptPriority)0;
			Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC2/Halcyonite/HalcyoniteMonsterWhirlwindRush.asset").WaitForCompletion().interruptPriority = (InterruptPriority)0;
			object obj = <>c.<>9__4_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, WhirlwindWarmUp self)
				{
					//IL_000e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0018: Expected O, but got Unknown
					if (((EntityState)self).isAuthority)
					{
						((EntityState)self).outer.SetNextState((EntityState)new WhirlWindPersuitCycle());
					}
				};
				<>c.<>9__4_0 = val;
				obj = (object)val;
			}
			WhirlwindWarmUp.OnEnter += (hook_OnEnter)obj;
			WhirlWindPersuitCycle.OnEnter += (hook_OnEnter)delegate(orig_OnEnter orig, WhirlWindPersuitCycle self)
			{
				//IL_005d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0075: 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_0099: Unknown result type (might be due to invalid IL or missing references)
				WhirlWindPersuitCycle.decelerateDuration = 1f;
				((Component)((EntityState)self).GetModelAnimator()).GetComponent<ChildLocator>();
				((EntityState)self).PlayCrossfade("FullBody Override", "WhirlwindRushEnter", "WhirlwindRush.playbackRate", 0.5f, 0.1f);
				Util.PlaySound("Play_halcyonite_skill3_start", ((Component)this).gameObject);
				((BaseState)self).SmallHop(((EntityState)self).characterMotor, 9f);
				CharacterGravityParameters gravityParameters = ((EntityState)self).characterMotor.gravityParameters;
				gravityParameters.channeledAntiGravityGranterCount++;
				((EntityState)self).characterMotor.gravityParameters = gravityParameters;
				CharacterFlightParameters flightParameters = ((EntityState)self).characterMotor.flightParameters;
				flightParameters.channeledFlightGranterCount++;
				((EntityState)self).characterMotor.flightParameters = flightParameters;
				((EntityState)self).characterMotor.walkSpeedPenaltyCoefficient = 0f;
				((EntityState)self).gameObject.AddComponent<origPersuit>();
				((EntityState)self).gameObject.GetComponent<origPersuit>().reset();
			};
			object obj2 = <>c.<>9__4_2;
			if (obj2 == null)
			{
				hook_FixedUpdate val2 = delegate(orig_FixedUpdate orig, WhirlWindPersuitCycle self)
				{
					origPersuit component = ((EntityState)self).gameObject.GetComponent<origPersuit>();
					if (!(component.fixedAge < 0.5f))
					{
						component.OnEnter(self);
						orig.Invoke(self);
					}
				};
				<>c.<>9__4_2 = val2;
				obj2 = (object)val2;
			}
			WhirlWindPersuitCycle.FixedUpdate += (hook_FixedUpdate)obj2;
			object obj3 = <>c.<>9__4_3;
			if (obj3 == null)
			{
				hook_CheckIfArrived val3 = delegate(orig_CheckIfArrived orig, WhirlWindPersuitCycle self)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					//IL_0009: 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_0022: Unknown result type (might be due to invalid IL or missing references)
					Ray aimRay2 = ((BaseState)self).GetAimRay();
					if (Vector3.Dot(((Ray)(ref aimRay2)).direction, self.targetMoveDirt) < 0f)
					{
						self.state = (PersuitState)3;
						self.startDecelerateTimeStamp = ((EntityState)self).gameObject.GetComponent<origPersuit>().fixedAge;
						self.startedDash = false;
					}
				};
				<>c.<>9__4_3 = val3;
				obj3 = (object)val3;
			}
			WhirlWindPersuitCycle.CheckIfArrived += (hook_CheckIfArrived)obj3;
			object obj4 = <>c.<>9__4_4;
			if (obj4 == null)
			{
				hook_UpdateDecelerate val4 = delegate(orig_UpdateDecelerate orig, WhirlWindPersuitCycle self)
				{
					//IL_0031: Unknown result type (might be due to invalid IL or missing references)
					//IL_003b: Unknown result type (might be due to invalid IL or missing references)
					//IL_006c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0071: Unknown result type (might be due to invalid IL or missing references)
					//IL_0020: Unknown result type (might be due to invalid IL or missing references)
					if (((EntityState)self).gameObject.GetComponent<origPersuit>().fixedAge > self.startDecelerateTimeStamp + WhirlWindPersuitCycle.decelerateDuration)
					{
						self.state = (PersuitState)4;
					}
					((EntityState)self).characterMotor.velocity = ((Vector3)(ref self.targetMoveDirt)).normalized * WhirlWindPersuitCycle.dashSpeedCoefficient * Mathf.Lerp(1f, 0f, (((EntityState)self).gameObject.GetComponent<origPersuit>().fixedAge - self.startDecelerateTimeStamp) / WhirlWindPersuitCycle.decelerateDuration);
				};
				<>c.<>9__4_4 = val4;
				obj4 = (object)val4;
			}
			WhirlWindPersuitCycle.UpdateDecelerate += (hook_UpdateDecelerate)obj4;
			WhirlWindPersuitCycle.UpdateFindTarget += (hook_UpdateFindTarget)delegate(orig_UpdateFindTarget orig, WhirlWindPersuitCycle self)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Expected O, but got Unknown
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0047: 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_0070: 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_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_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_00cd: 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)
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
				//IL_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_0123: Unknown result type (might be due to invalid IL or missing references)
				Ray aimRay = ((BaseState)self).GetAimRay();
				BullseyeSearch val6 = new BullseyeSearch();
				val6.viewer = ((EntityState)self).characterBody;
				val6.maxDistanceFilter = WhirlWindPersuitCycle.maxSearchDist;
				val6.searchOrigin = ((Ray)(ref aimRay)).origin;
				val6.searchDirection = ((Ray)(ref aimRay)).direction;
				val6.filterByLoS = false;
				val6.sortMode = (SortMode)2;
				val6.teamMaskFilter = TeamMask.allButNeutral;
				if (Object.op_Implicit((Object)(object)((EntityState)self).teamComponent))
				{
					((TeamMask)(ref val6.teamMaskFilter)).RemoveTeam(((EntityState)self).teamComponent.teamIndex);
				}
				val6.RefreshCandidates();
				HurtBox val7 = val6.GetResults().FirstOrDefault();
				if ((Object)(object)val7 != (Object)null)
				{
					self.targetBody = val7.healthComponent.body;
					Vector3 footPosition = self.targetBody.footPosition;
					Vector3 val8 = ((Component)this).transform.position - self.targetBody.footPosition;
					self.targetPos = footPosition + ((Vector3)(ref val8)).normalized * 2f;
				}
				else
				{
					self.targetPos = ((Ray)(ref aimRay)).origin + ((Ray)(ref aimRay)).direction;
				}
				self.findTargetTimeStamp = ((EntityState)self).fixedAge;
				self.startForwardDirt = ((EntityState)self).characterDirection.forward;
				self.state = (PersuitState)2;
			};
			object obj5 = <>c.<>9__4_6;
			if (obj5 == null)
			{
				hook_GetMinimumInterruptPriority val5 = (orig_GetMinimumInterruptPriority orig, WhirlWindPersuitCycle self) => (InterruptPriority)2;
				<>c.<>9__4_6 = val5;
				obj5 = (object)val5;
			}
			WhirlWindPersuitCycle.GetMinimumInterruptPriority += (hook_GetMinimumInterruptPriority)obj5;
		}
	}
}