Decompiled source of PhaseDash v1.0.1

phaseDash.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 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 = "")]
[assembly: AssemblyCompany("phaseDash")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("phaseDash")]
[assembly: AssemblyTitle("phaseDash")]
[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 phaseDash
{
	[BepInPlugin("com.erwer.phaseDash", "phaseDash", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.erwer.phaseDash";

		public const string PLUGIN_NAME = "phaseDash";

		public const string PLUGIN_VERSION = "1.0.0";

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.erwer.phaseDash is loaded!");
			Harmony val = new Harmony("com.erwer.phaseDash");
			val.PatchAll(typeof(Patches));
		}
	}
	public class Patches
	{
		[HarmonyPatch(typeof(Dash), "performDash")]
		[HarmonyPostfix]
		public static void PatchDash(Dash __instance)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_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_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: 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_005c: 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_0066: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: 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)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: 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_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			Fix val = __instance.smearBaseLength * __instance.body.fixtrans.Scale;
			if (Vec2.Magnitude(__instance.inputVector) < Constants.DEADZONE)
			{
				__instance.inputVector = Vec2.up;
			}
			__instance.inputVector = Vec2.Normalized(__instance.inputVector);
			Fix rotationFromDirection = Tools.GetRotationFromDirection(__instance.inputVector, Vec2.up);
			__instance.body.rotation = rotationFromDirection;
			((Component)__instance).transform.rotation = Quaternion.Euler(new Vector3(0f, 0f, (float)rotationFromDirection * 57.29578f));
			__instance.updatesPassedInDash = 0;
			__instance.body.selfImposedVelocity = Vec2.zero;
			__instance.body.externalVelocity = Vec2.zero;
			((Renderer)__instance.SmearFrame).enabled = true;
			((Renderer)__instance.spriteRen).enabled = false;
			((Renderer)__instance.SmearFrame).material.SetColor("_ShadowColor", ((Renderer)__instance.spriteRen).material.GetColor("_ShadowColor"));
			((Renderer)__instance.SmearFrame).material.SetColor("_MainColor", ((Renderer)__instance.spriteRen).material.GetColor("_MainColor"));
			((Renderer)__instance.SmearFrame).material.SetColor("_ReflectionColour", ((Renderer)__instance.spriteRen).material.GetColor("_ReflectionColour"));
			__instance.hitGround = null;
			((Component)__instance.SmearFrame).GetComponent<DPhysicsBox>();
			Vector3 position = ((Component)__instance).transform.position;
			position = ((Component)__instance).transform.position;
			Vec2 val2 = (Vec2)position + __instance.inputVector * __instance.dashLength;
			if (val2.y <= SceneBounds.WaterHeight)
			{
				val2.y = SceneBounds.WaterHeight;
			}
			Vector2 val3 = (Vector2)(val2 - (Vec2)position);
			float num = ((Vector2)(ref val3)).magnitude;
			((Component)__instance.SmearFrame).transform.localScale = new Vector3(1f, num / (float)val, 1f);
			((Renderer)__instance.SmearFrame).material.SetVector("_Scale", new Vector4(1f, ((Component)__instance.SmearFrame).transform.localScale.y * __instance.smearScaling, 1f));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "phaseDash";

		public const string PLUGIN_NAME = "phaseDash";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}