Decompiled source of OpAbilities v2.0.1

OpAbilities.dll

Decompiled 4 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("OpAbilities")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OpAbilities")]
[assembly: AssemblyTitle("OpAbilities")]
[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 OpAbilities
{
	[BepInPlugin("com.erewrwerwerwerwerwerwer.OpAbilities", "OpAbilities", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public class Patches
		{
			[HarmonyPatch(typeof(BowTransform), "Shoot")]
			[HarmonyPrefix]
			public static void bowPatch(BowTransform __instance)
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				__instance.ArrowSpeed = (Fix)100L;
			}

			[HarmonyPatch(typeof(Drill), "Awake")]
			[HarmonyPrefix]
			public static void drillPatch(Drill __instance)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: 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)
				__instance.minUndergroundSpeed = (Fix)100f;
				__instance.rotationSpeedAir = (Fix)100f;
			}

			[HarmonyPatch(typeof(Shockwave), "Awake")]
			[HarmonyPrefix]
			public static void ShockwavePatch(Shockwave __instance)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: 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_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)
				__instance.defaultForce = (Fix)2f;
				__instance.platformForce = (Fix)10f;
				__instance.groundedPlayerForceMultiplier = (Fix)(-2f);
			}

			[HarmonyPatch(typeof(Mine), "Update")]
			[HarmonyPrefix]
			public static void MinePatch(Mine __instance)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: 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)
				//IL_0026: Invalid comparison between Unknown and I4
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Invalid comparison between Unknown and I4
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				SpriteRenderer component = ((Component)__instance).gameObject.GetComponent<SpriteRenderer>();
				Color color = component.color;
				__instance.maxAlpha = 0.4f;
				if ((int)__instance.state == 1)
				{
					color.a = 0f;
				}
				else if ((int)__instance.state == 0)
				{
					color.a = 1f - (float)__instance.timeSinceSpawned * 0.5f;
					color.a = Mathf.Clamp(color.a, 0f, 1f);
				}
				else
				{
					color.a = 1f;
				}
				component.color = color;
				__instance.scanRadius = (Fix)20f;
				__instance.chaseTime = (Fix)100f;
			}

			[HarmonyPatch(typeof(RocketEngine), "Update")]
			[HarmonyPrefix]
			public static void RocketEnginePatch(RocketEngine __instance)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				__instance.timeSinceEngineStarted = (Fix)0.7f;
			}

			[HarmonyPatch(typeof(Missile), "Awake")]
			[HarmonyPrefix]
			public static void MissileUpdateSimPatch(Missile __instance)
			{
				//IL_0004: 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_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				__instance.accel = (Fix)6L;
				__instance.minimumForwardsSpeed = (Fix)85f;
			}

			[HarmonyPatch(typeof(BounceBall), "LateUpdateSim")]
			[HarmonyPrefix]
			public static void BoucceBallPatch(BounceBall __instance)
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				__instance.IsCancellable = true;
				__instance.shockwaveForce = (Fix)(-100L);
			}

			[HarmonyPatch(typeof(Beam), "UpdateBeam")]
			[HarmonyPrefix]
			public static void UpdateBeam(Beam __instance, Fix simDeltaTime)
			{
				//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: 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_0024: Unknown result type (might be due to invalid IL or missing references)
				//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_002e: 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_003e: 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: Invalid comparison between Unknown and I4
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0060: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: 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_0076: 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_007d: 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_0088: Unknown result type (might be due to invalid IL or missing references)
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_009c: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bb: Invalid comparison between Unknown and I4
				//IL_00d2: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: Unknown result type (might be due to invalid IL or missing references)
				//IL_0115: Unknown result type (might be due to invalid IL or missing references)
				//IL_0116: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: 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_0121: Unknown result type (might be due to invalid IL or missing references)
				//IL_0129: Unknown result type (might be due to invalid IL or missing references)
				//IL_012e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0136: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_016c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0186: Unknown result type (might be due to invalid IL or missing references)
				//IL_018b: 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_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_0198: Unknown result type (might be due to invalid IL or missing references)
				//IL_019d: Unknown result type (might be due to invalid IL or missing references)
				Vec2 val = __instance.FirePos();
				Fix val2 = Fix.One;
				Fix val3 = (__instance.inAir ? __instance.maxTimeAir : __instance.maxTime);
				Fix val4 = (Fix)4L;
				if (__instance.timeSinceBeamStart + __instance.exitScaleTime > val3 && (int)__instance.state == 1 && __instance.timeSinceBeamStart + __instance.exitScaleTime > val3)
				{
					Fix val5 = (__instance.exitScaleTime - (val3 - __instance.timeSinceBeamStart)) / __instance.exitScaleTime;
					val2 = __instance.exitScaleAnim.Evaluate(val5);
				}
				if (val.y >= Constants.WATER_HEIGHT || (int)Constants.leveltype == 2)
				{
					__instance.beamIndex = DetPhysics.Get().AddBeamBody(new BeamBody
					{
						position = val + __instance.staffDir * __instance.beamOffset,
						direction = __instance.staffDir,
						scale = __instance.body.fixtrans.Scale * val2 * val4,
						colors = __instance.playerBeamColor,
						timePassed = __instance.timeSinceBeamStart,
						id = ((MonoUpdatable)__instance).HierarchyNumber,
						ownerId = __instance.player.Id,
						ground = __instance.currentGround
					});
				}
				else
				{
					__instance.beamIndex = -1;
				}
				__instance.timeSinceBeamStart += simDeltaTime / (Fix)4L;
			}

			[HarmonyPatch(typeof(BlackHole), "Update")]
			[HarmonyPrefix]
			private static void BlackholePatch(BlackHole __instance)
			{
				//IL_009a: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: 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_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_0074: 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)
				if ((Object)(object)__instance.forceArrow == (Object)null)
				{
					return;
				}
				if (GameTime.IsTimeStopped())
				{
					((Component)__instance.forceArrow).gameObject.SetActive(true);
				}
				if (((Component)__instance.forceArrow).gameObject.activeSelf)
				{
					if (GameTime.IsTimeStopped() && __instance.dCircle.initHasBeenCalled && !GameSessionHandler.GameIsPaused)
					{
						__instance.forceArrow.SetForce((Vector2)__instance.velocity);
						return;
					}
					((Component)__instance.forceArrow).gameObject.SetActive(false);
				}
				if (__instance.mass != 0L)
				{
					bool flag = __instance.mass < 0L;
					Fix val = (Fix)0.1f;
					if (flag)
					{
						val = (Fix)(-0.1f);
					}
					__instance.GrowIncrementally(val);
				}
			}

			[HarmonyPatch(typeof(Ability), "Awake")]
			[HarmonyPostfix]
			public static void CustomizeCooldown(ref Ability __instance)
			{
				//IL_001d: 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)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0048: Unknown result type (might be due to invalid IL or missing references)
				//IL_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006e: 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_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bc: 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_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_010c: Unknown result type (might be due to invalid IL or missing references)
				if (((Object)__instance).name.StartsWith("Revival"))
				{
					__instance.Cooldown = (Fix)0.2f;
				}
				if (((Object)__instance).name.StartsWith("Bow"))
				{
					__instance.Cooldown = (Fix)0.2f;
				}
				if (((Object)__instance).name.StartsWith("Rock"))
				{
					__instance.Cooldown = (Fix)0.1f;
				}
				if (((Object)__instance).name.StartsWith("Dash"))
				{
					__instance.Cooldown = (Fix)0.3f;
				}
				if (((Object)__instance).name.StartsWith("Blackhole"))
				{
					__instance.Cooldown = (Fix)0.5f;
				}
				if (((Object)__instance).name.StartsWith("Shrink"))
				{
					__instance.Cooldown = (Fix)0.1f;
				}
				if (((Object)__instance).name.StartsWith("Grow"))
				{
					__instance.Cooldown = (Fix)0.1f;
				}
			}
		}

		private static Harmony harmony;

		private void Awake()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin OpAbilities is loaded!");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Wowie, you found a RNG log file 1/1000 chance; now find the rest.");
			harmony = new Harmony("me.erewrwerwerwerwerwerwerOpAbilities");
			harmony.PatchAll(typeof(Patches));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "OpAbilities";

		public const string PLUGIN_NAME = "OpAbilities";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}