Decompiled source of NoSpikeDisappear v1.0.0

NoSpikeDisappear.dll

Decompiled 6 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 BoplFixedMath;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("NoSpikeDisappear")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoSpikeDisappear")]
[assembly: AssemblyTitle("NoSpikeDisappear")]
[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 BoplBattleTemplate
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NoSpikeDisappear";

		public const string PLUGIN_NAME = "NoSpikeDisappear";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MoreThanOneSpike
{
	[BepInPlugin("com.ra4ina.MoreThanOneSpike", "MoreThanOneSpike", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin MoreThanOneSpike is loaded!");
			Harmony val = new Harmony("com.ra4ina.MoreThanOneSpike");
			MethodInfo methodInfo = AccessTools.Method(typeof(Spike), "CastSpike", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(MyPatch), "CastSpike_Spike_modif", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}
	public class MyPatch
	{
		public static bool CastSpike_Spike_modif(Spike __instance, ref PlayerPhysics ___playerPhysics, ref DPhysicsRoundedRect ___groundRect, ref PlayerBody ___body, ref ParticleSystem ___dustParticle, ref ParticleSystem ___dustParticleFar, ref ShakableCamera ___shakeCam, ref SpikeAttack ___currentSpike, ref SpikeAttack ___spikePrefab, ref Fix ___surfaceOffset, ref Fix ___castForce, ref AnimationData ___animData, ref SpriteAnimator ___animator)
		{
			//IL_0068: 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_0072: 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_0079: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_008f: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: 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_010e: 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_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: 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_01a2: 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_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: 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_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: 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_00ba: 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)
			StickyRoundedRectangle attachedGround = ___playerPhysics.getAttachedGround();
			if ((Object)(object)attachedGround == (Object)null || ((MonoUpdatable)attachedGround).IsDestroyed || !attachedGround.ThisGameObject().activeInHierarchy)
			{
				__instance.ExitAbility(default(AbilityExitInfo));
				return false;
			}
			___groundRect = ((Component)attachedGround).GetComponent<DPhysicsRoundedRect>();
			Vec2 val = attachedGround.currentNormal(___body.position);
			Fix zero = Fix.Zero;
			Fix zero2 = Fix.Zero;
			if (!Raycast.RayCastRoundedRect(___body.position, -val, ___groundRect.GetRoundedRect(), ref zero, ref zero2))
			{
				MonoBehaviour.print((object)"Spike raycast inexplicibly missed");
				__instance.ExitAbility(default(AbilityExitInfo));
				return false;
			}
			Vec2 val2 = ___body.position - val * zero2;
			AudioManager.Get().Play("spikeRock");
			((Component)___dustParticle).transform.parent.position = ((Component)__instance).transform.position;
			((Component)___dustParticle).transform.parent.up = ((Component)__instance).transform.up;
			___dustParticle.Play();
			((Component)___dustParticleFar).transform.parent.position = (Vector3)val2;
			((Component)___dustParticleFar).transform.parent.up = ((Component)__instance).transform.up;
			___dustParticleFar.Play();
			___shakeCam.AddTrauma(0.3f);
			Vec2 val3 = val2;
			___currentSpike = FixTransform.InstantiateFixed<SpikeAttack>(___spikePrefab, val3);
			FixTransform component = ((Component)___currentSpike).GetComponent<FixTransform>();
			component.up = val;
			((Component)component).transform.SetParent(((Component)___groundRect).transform);
			((Component)___currentSpike).transform.localScale = new Vector3(1f / ((Component)attachedGround).transform.localScale.x, 1f / ((Component)attachedGround).transform.localScale.x, 1f);
			___currentSpike.Initialize(val2, ___surfaceOffset, attachedGround);
			DetPhysics.Get().AddBoxToRR(((Object)((Component)___currentSpike).gameObject).GetInstanceID(), ((Object)((Component)attachedGround).gameObject).GetInstanceID());
			___currentSpike.UpdateRelativeOrientation();
			___currentSpike.UpdatePosition();
			___currentSpike.GetHitbox().Scale = ___body.fixtrans.Scale;
			attachedGround.GetGroundBody().AddForceAtPosition(val * ___castForce, ___body.position, (ForceMode2D)0);
			___animator.beginAnimThenDoAction(___animData.GetAnimation("recover"), (Action)delegate
			{
				//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)
				__instance.ExitAbility(default(AbilityExitInfo));
			});
			return false;
		}
	}
}