Decompiled source of AtomMissle v1.0.0

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

		public const string PLUGIN_NAME = "atomMissile";

		public const string PLUGIN_VERSION = "1.0.0";

		internal static Sprite atomMissileSprite;

		internal static ConfigFile config;

		internal static ConfigEntry<double> missilePower;

		private void Awake()
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.erwer.atomMissile is loaded!");
			config = ((BaseUnityPlugin)this).Config;
			missilePower = config.Bind<double>("Settings", "Atom Missile (Multiplier)", 12.0, "Minimum is 0.0 (Negitives default to 1).\n MAX : 20\n Suggested Value : 12");
			if (missilePower.Value < 1.0)
			{
				missilePower.Value = 1.0;
			}
			if (missilePower.Value > 20.0)
			{
				missilePower.Value = 20.0;
			}
			Harmony val = new Harmony("com.erwer.atomMissile");
			val.PatchAll(typeof(Patches));
		}
	}
	public class Patches
	{
		[HarmonyPatch(typeof(Missile), "OnCollide")]
		[HarmonyPrefix]
		public static bool OnCollide(Missile __instance, ref CollisionInformation collision)
		{
			//IL_003f: 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_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (collision.layer != LayerMask.NameToLayer("RigidBodyAffector") && collision.layer != LayerMask.NameToLayer("Rope"))
			{
				Explosion val = FixTransform.InstantiateFixed<Explosion>(__instance.onHitExplosionPrefab, __instance.body.position);
				IPhysicsCollider component = ((Component)val).GetComponent<IPhysicsCollider>();
				if (component != null)
				{
					component.Scale = __instance.fixTrans.Scale * (Fix)Plugin.missilePower.Value;
				}
				else
				{
					Debug.LogWarning((object)"Explosion prefab does not have an IPhysicsCollider component.");
				}
				if (!string.IsNullOrEmpty(__instance.soundEffectOnCol))
				{
					AudioManager.Get().Play(__instance.soundEffectOnCol);
				}
				Updater.DestroyFix(((Component)__instance).gameObject);
			}
			return false;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "atomMissile";

		public const string PLUGIN_NAME = "atomMissile";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}