Decompiled source of ComicallySlowMines v1.0.0

ComicallySlowMines.dll

Decompiled 7 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("ComicallySlowMines")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Comically Slow Mines that chase you from anywhere on the map. YOU BETTER START RUNNING")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ComicallySlowMines")]
[assembly: AssemblyTitle("ComicallySlowMines")]
[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 BetterMine
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "ComicallySlowMines";

		public const string PLUGIN_NAME = "ComicallySlowMines";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ComicallySlowMines
{
	[BepInPlugin("com.savaGe.ComicallySlowMines", "ComicallySlowMines", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public class Patches
		{
			[HarmonyPostfix]
			[HarmonyPatch(typeof(Mine), "Awake")]
			public static void PluginPatches(Mine __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)
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: 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)
				__instance.scanRadius = (Fix)200f;
				__instance.HoverStr = (Fix)200f;
				__instance.TimeBeforeArmed = (Fix)1f;
				__instance.chaseStrength = (Fix)120f;
				__instance.chaseTime = (Fix)10f;
			}

			public static bool Gust(Shockwave shockwave, Fix simDeltaTime)
			{
				//IL_001a: 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: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0286: Unknown result type (might be due to invalid IL or missing references)
				//IL_028b: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				//IL_016f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_02be: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
				//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
				//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
				//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
				//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_0303: Unknown result type (might be due to invalid IL or missing references)
				//IL_0308: Unknown result type (might be due to invalid IL or missing references)
				//IL_030d: Unknown result type (might be due to invalid IL or missing references)
				//IL_030f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0312: Unknown result type (might be due to invalid IL or missing references)
				//IL_0317: Unknown result type (might be due to invalid IL or missing references)
				//IL_031c: Unknown result type (might be due to invalid IL or missing references)
				//IL_031e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0320: Unknown result type (might be due to invalid IL or missing references)
				//IL_0325: Unknown result type (might be due to invalid IL or missing references)
				//IL_032a: Unknown result type (might be due to invalid IL or missing references)
				//IL_032e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0330: Unknown result type (might be due to invalid IL or missing references)
				//IL_0332: Unknown result type (might be due to invalid IL or missing references)
				//IL_029f: Unknown result type (might be due to invalid IL or missing references)
				//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_018c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0191: Unknown result type (might be due to invalid IL or missing references)
				//IL_0196: 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)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ca: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d3: 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_01e7: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
				//IL_0200: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: Unknown result type (might be due to invalid IL or missing references)
				//IL_0204: Unknown result type (might be due to invalid IL or missing references)
				//IL_0209: Unknown result type (might be due to invalid IL or missing references)
				//IL_020e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: 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_0221: Unknown result type (might be due to invalid IL or missing references)
				//IL_0223: Unknown result type (might be due to invalid IL or missing references)
				//IL_0225: Unknown result type (might be due to invalid IL or missing references)
				//IL_025d: Unknown result type (might be due to invalid IL or missing references)
				//IL_025f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0261: 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_0271: Unknown result type (might be due to invalid IL or missing references)
				shockwave.gameObjectIdsHit.Clear();
				shockwave.hitCount = DetPhysics.Get().CircleCastAll(shockwave.fixTrans.position, shockwave.radius * shockwave.scale, shockwave.collisionMask, ref shockwave.hits);
				for (int i = 0; i < shockwave.hitCount; i++)
				{
					int instanceId = shockwave.hits[i].instanceId;
					if (shockwave.gameObjectIdsHit.Contains(instanceId) || (Object)(object)shockwave.hits[i].fixTrans == (Object)null || shockwave.hits[i].fixTrans.IsDestroyed || shockwave.hits[i].monobehaviourCollider == null)
					{
						continue;
					}
					if (((Component)shockwave.hits[i].fixTrans).gameObject.layer == LayerMask.NameToLayer("Mine"))
					{
						Ability component = ((Component)shockwave.hits[i].fixTrans).gameObject.GetComponent<Ability>();
						if ((Object)(object)component != (Object)null && !component.isPushable)
						{
							continue;
						}
						PlayerPhysics component2 = ((Component)shockwave.hits[i].fixTrans).GetComponent<PlayerPhysics>();
						if ((Object)(object)component2 == (Object)null)
						{
							PlayerBody component3 = ((Component)shockwave.hits[i].fixTrans).GetComponent<PlayerBody>();
							Fix val = Fix.One;
							if (!shockwave.CallEveryFrame)
							{
								val = (Fix)7L;
							}
							Fix val2 = (shockwave.scale + Fix.One) / (Fix)2L;
							Vec2 val3 = shockwave.hits[i].fixTrans.position - shockwave.fixTrans.position;
							Fix val4 = Fix.Max(Vec2.SqrMagnitude(val3) / (Fix)10L, (Fix)3L);
							Fix val5 = val2 * shockwave.defaultForce / (val4 * val);
							if ((Object)(object)component3 != (Object)null)
							{
								component3.AddForce(val3 * val5);
								continue;
							}
							BoplBody component4 = ((Component)shockwave.hits[i].fixTrans).GetComponent<BoplBody>();
							if ((Object)(object)component4 != (Object)null)
							{
								component4.AddForce(val3 * val5 * (Fix)9000L, (ForceMode2D)0);
							}
						}
						else
						{
							Fix val6 = Fix.One;
							if (!shockwave.CallEveryFrame)
							{
								val6 = (Fix)7L;
							}
							Fix val7 = (shockwave.scale + Fix.One) / (Fix)2L;
							Vec2 val8 = shockwave.hits[i].fixTrans.position - shockwave.fixTrans.position;
							Fix val9 = Fix.Max(Vec2.SqrMagnitude(val8) / (Fix)10L, (Fix)3L);
							Fix val10 = val7 * shockwave.defaultForce / (val9 * val6);
							component2.AddForce(val8 * val10);
						}
						continue;
					}
					shockwave.gameObjectIdsHit.Add(instanceId);
					if (shockwave.isGustAbility && !AchievementHandler.IsAchieved((AchievementEnum)25) && ((Component)shockwave.hits[i].fixTrans).gameObject.layer == LayerMask.NameToLayer("item"))
					{
						GrenadeExplode component5 = ((Component)shockwave.hits[i].fixTrans).GetComponent<GrenadeExplode>();
						if ((Object)(object)component5 != (Object)null && !((MonoUpdatable)component5).IsDestroyed)
						{
							component5.hasBeenGustedBy = shockwave.ownerId;
						}
					}
				}
				shockwave.UpdateHitObjects(simDeltaTime);
				return false;
			}
		}

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.savaGe.ComicallySlowMines");
			val.PatchAll(typeof(Patches));
		}
	}
}