Decompiled source of BouncySeekerM1 v1.0.0

BouncySeekerM1.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates.Seeker;
using IL.EntityStates.Seeker;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Seeker;
using RoR2;
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("BouncySeekerM1")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BouncySeekerM1")]
[assembly: AssemblyTitle("BouncySeekerM1")]
[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 BouncySeekerM1
{
	[BepInPlugin("com.Nuxlar.BouncySeekerM1", "BouncySeekerM1", "1.0.0")]
	public class BouncySeekerM1 : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_OnEnter <>9__7_0;

			public static Func<Instruction, bool> <>9__7_2;

			public static Manipulator <>9__7_1;

			internal void <Awake>b__7_0(orig_OnEnter orig, SpiritPunch self)
			{
				orig.Invoke(self);
				self.bloom = 0.1f;
				self.damageCoefficient = 2.5f;
				self.comboDamageCoefficient = 3.5f;
			}

			internal void <Awake>b__7_1(ILContext il)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				ILCursor val = new ILCursor(il);
				if (val.TryGotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 70f)
				}))
				{
					val.Next.Operand = 100f;
				}
				else
				{
					Debug.LogError((object)"BouncySpiritPunch: Failed apply SpiritPunch.FireGauntlet hook");
				}
			}

			internal bool <Awake>b__7_2(Instruction x)
			{
				return ILPatternMatchingExt.MatchLdcR4(x, 70f);
			}
		}

		private GameObject seekerPrimaryProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SpiritPunchProjectile.prefab").WaitForCompletion();

		private GameObject seekerPrimaryImpactVFX = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SpiritPunchOmniImpactVFX.prefab").WaitForCompletion();

		private GameObject seekerPrimaryFinisherProjectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SpiritPunchFinisherProjectile.prefab").WaitForCompletion();

		private GameObject seekerPrimaryFinisherDissipateVFX = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SpiritPunchDissipateVFX.prefab").WaitForCompletion();

		private GameObject seekerSecondary1MuzzleFlash = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SoulSpiralMuzzleflashVFX.prefab").WaitForCompletion();

		private GameObject seekerBodyPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/Seeker/SeekerBody.prefab").WaitForCompletion();

		private PhysicMaterial physicMaterial = Addressables.LoadAssetAsync<PhysicMaterial>((object)"RoR2/Base/Common/physmatSuperBouncy.physicMaterial").WaitForCompletion();

		public void Awake()
		{
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Expected O, but got Unknown
			//IL_0149: 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_0154: Expected O, but got Unknown
			Object.Destroy((Object)(object)seekerPrimaryProjectile.GetComponent<ProjectileOverlapAttack>());
			ProjectileSimple component = seekerPrimaryProjectile.GetComponent<ProjectileSimple>();
			component.lifetime = 2f;
			component.desiredForwardSpeed = 100f;
			component.lifetimeExpiredEffect = seekerPrimaryFinisherDissipateVFX;
			((Collider)seekerPrimaryProjectile.GetComponent<SphereCollider>()).isTrigger = false;
			((Collider)seekerPrimaryProjectile.GetComponent<SphereCollider>()).material = physicMaterial;
			seekerPrimaryProjectile.AddComponent<ProjectileSingleTargetImpact>().impactEffect = seekerPrimaryImpactVFX;
			ProjectileSimple component2 = seekerPrimaryFinisherProjectile.GetComponent<ProjectileSimple>();
			component2.lifetime = 1.7f;
			component2.desiredForwardSpeed = 100f;
			((Collider)seekerPrimaryFinisherProjectile.GetComponent<SphereCollider>()).material = physicMaterial;
			ProjectileImpactExplosion component3 = seekerPrimaryFinisherProjectile.GetComponent<ProjectileImpactExplosion>();
			component3.lifetime = 1.5f;
			component3.destroyOnWorld = false;
			SetAddressableEntityStateField("RoR2/DLC2/Seeker/EntityStates.Seeker.UnseenHand.asset", "muzzleflashEffect", (Object)(object)seekerSecondary1MuzzleFlash);
			seekerBodyPrefab.GetComponent<SkillLocator>().primary.skillFamily.variants[0].skillDef.skillDescriptionToken = "Fire <style=cIsUtility>ricocheting</style> fists at enemies for <style=cIsDamage>250% damage</style>. Every 3rd hit explodes dealing <style=cIsDamage>350% damage</style> and increases in damage.";
			object obj = <>c.<>9__7_0;
			if (obj == null)
			{
				hook_OnEnter val = delegate(orig_OnEnter orig, SpiritPunch self)
				{
					orig.Invoke(self);
					self.bloom = 0.1f;
					self.damageCoefficient = 2.5f;
					self.comboDamageCoefficient = 3.5f;
				};
				<>c.<>9__7_0 = val;
				obj = (object)val;
			}
			SpiritPunch.OnEnter += (hook_OnEnter)obj;
			object obj2 = <>c.<>9__7_1;
			if (obj2 == null)
			{
				Manipulator val2 = delegate(ILContext il)
				{
					//IL_0001: Unknown result type (might be due to invalid IL or missing references)
					//IL_0007: Expected O, but got Unknown
					ILCursor val3 = new ILCursor(il);
					if (val3.TryGotoNext(new Func<Instruction, bool>[1]
					{
						(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 70f)
					}))
					{
						val3.Next.Operand = 100f;
					}
					else
					{
						Debug.LogError((object)"BouncySpiritPunch: Failed apply SpiritPunch.FireGauntlet hook");
					}
				};
				<>c.<>9__7_1 = val2;
				obj2 = (object)val2;
			}
			SpiritPunch.FireGauntlet += (Manipulator)obj2;
		}

		public bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, string value)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value;
					return true;
				}
			}
			return false;
		}

		public bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, Object newObject)
		{
			//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)
			EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion();
			for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++)
			{
				if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName)
				{
					val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject;
					return true;
				}
			}
			return false;
		}
	}
}