Decompiled source of HalcyoniteFixes v1.0.2

HalcyoniteFixes.dll

Decompiled 2 months 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 EntityStates.Halcyonite;
using KinematicCharacterController;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using RoR2.CharacterAI;
using RoR2.Projectile;
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("HalcyoniteFixes")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HalcyoniteFixes")]
[assembly: AssemblyTitle("HalcyoniteFixes")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
namespace HalcyoniteFixes
{
	[BepInPlugin("com.Nuxlar.HalcyoniteFixes", "HalcyoniteFixes", "1.0.2")]
	public class HalcyoniteFixes : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnBodyStart <>9__2_0;

			internal void <Awake>b__2_0(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
			{
				//IL_0030: 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)
				orig.Invoke(self, body);
				if (((Object)body).name == "HalcyoniteBody(Clone)")
				{
					CapsuleCollider component = ((Component)body).GetComponent<CapsuleCollider>();
					component.center = new Vector3(0f, 0f, 0f);
					component.height = -1.25f;
					KinematicCharacterMotor component2 = ((Component)body).GetComponent<KinematicCharacterMotor>();
					component2.CapsuleYOffset = 0f;
					component2.CapsuleHeight = -1.25f;
					body.modelLocator.modelTransform.GetChild(4).localScale = new Vector3(4f, 5f, 12f);
				}
			}
		}

		private GameObject halcyoniteMaster = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Halcyonite/HalcyoniteMaster.prefab").WaitForCompletion();

		private GameObject halcyoniteProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Halcyonite/WhirlWindHalcyoniteProjectile.prefab").WaitForCompletion();

		public void Awake()
		{
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			halcyoniteProjectile.AddComponent<HFProjectileDestroyer>();
			foreach (AISkillDriver item in halcyoniteMaster.GetComponents<AISkillDriver>().ToList())
			{
				if (item.customName == "Follow Target")
				{
					item.ignoreNodeGraph = false;
					item.driverUpdateTimerOverride = -1f;
					item.noRepeat = false;
				}
				if (item.customName == "Golden Swipe")
				{
					item.maxDistance = 17f;
					item.minDistance = 12f;
					item.selectionRequiresAimTarget = true;
					item.selectionRequiresTargetLoS = true;
				}
				if (item.customName == "Golden Slash")
				{
					item.maxDistance = 12f;
					item.selectionRequiresTargetLoS = true;
				}
				if (item.customName == "Follow Nodegraph")
				{
					Object.Destroy((Object)(object)item);
				}
				object obj = <>c.<>9__2_0;
				if (obj == null)
				{
					hook_OnBodyStart val = delegate(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
					{
						//IL_0030: 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)
						orig.Invoke(self, body);
						if (((Object)body).name == "HalcyoniteBody(Clone)")
						{
							CapsuleCollider component = ((Component)body).GetComponent<CapsuleCollider>();
							component.center = new Vector3(0f, 0f, 0f);
							component.height = -1.25f;
							KinematicCharacterMotor component2 = ((Component)body).GetComponent<KinematicCharacterMotor>();
							component2.CapsuleYOffset = 0f;
							component2.CapsuleHeight = -1.25f;
							body.modelLocator.modelTransform.GetChild(4).localScale = new Vector3(4f, 5f, 12f);
						}
					};
					<>c.<>9__2_0 = val;
					obj = (object)val;
				}
				CharacterMaster.OnBodyStart += (hook_OnBodyStart)obj;
			}
		}
	}
	public class HFProjectileDestroyer : MonoBehaviour
	{
		public EntityStateMachine esm;

		public void Start()
		{
			ProjectileController component = ((Component)this).GetComponent<ProjectileController>();
			if (!Object.op_Implicit((Object)(object)component))
			{
				return;
			}
			foreach (EntityStateMachine item in component.owner.GetComponents<EntityStateMachine>().ToList())
			{
				if (item.customName == "Weapon")
				{
					esm = item;
				}
			}
		}

		private void FixedUpdate()
		{
			if (Object.op_Implicit((Object)(object)esm) && ((object)esm.state).GetType() != typeof(WhirlwindRush))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
}