Decompiled source of homingNade v1.0.0

trackingNade.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
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("trackingNade")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("trackingNade")]
[assembly: AssemblyTitle("trackingNade")]
[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 trackingNade
{
	[BepInPlugin("com.erwer.trackingNade", "trackingNade", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "com.erwer.trackingNade";

		public const string PLUGIN_NAME = "trackingNade";

		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.trackingNade is loaded!");
			Harmony val = new Harmony("com.erwer.trackingNade");
			val.PatchAll(typeof(Patches));
		}
	}
	internal class Patches
	{
		[HarmonyPatch(typeof(Grenade), "UpdateSim")]
		[HarmonyPostfix]
		public static void UpdateSim(Grenade __instance)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: 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)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: 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_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: 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_01f8: 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_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: 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_0213: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: 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_0233: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			Fix val = (Fix)80f;
			Fix val2 = (Fix)130f;
			if (!__instance.hasBeenThrown || ((MonoUpdatable)__instance.body).IsDestroyed || __instance.body.physicsCollider == null)
			{
				return;
			}
			PhysicsParent[] array = (PhysicsParent[])(object)new PhysicsParent[4];
			LayerMask val3 = LayerMask.op_Implicit(1 << LayerMask.NameToLayer("Player"));
			int num = DetPhysics.Get().CircleCastAll(__instance.body.position, val * __instance.body.physicsCollider.Scale, val3, ref array);
			int num2 = 0;
			FixTransform val4 = null;
			while (num2 < num)
			{
				IPlayerIdHolder component = ((Component)array[num2].fixTrans).GetComponent<IPlayerIdHolder>();
				if (component != null)
				{
					Player player = PlayerHandler.Get().GetPlayer(component.GetPlayerId());
					Item component2 = ((Component)__instance.body).GetComponent<Item>();
					if (player == null || player.isInvisible || component2.OwnerId == component.GetPlayerId())
					{
						num2++;
						continue;
					}
				}
				val4 = array[num2].fixTrans;
				break;
			}
			if ((Object)(object)val4 != (Object)null)
			{
				List<RaycastInformation> list = new List<RaycastInformation>();
				Vec2 val5 = Vec2.Normalized(val4.position - __instance.body.position);
				Fix val6 = Vec2.Magnitude(val4.position - __instance.body.position);
				DetPhysics.instance.RaycastAll(__instance.body.position, val5, val6, LayerMask.op_Implicit(1 << LayerMask.NameToLayer("wall")), list, 0);
				if (!GameTime.IsTimeStopped() && list.Count <= 0)
				{
					Vec2 val7 = val4.position - __instance.body.position;
					Vec2 val8 = Vec2.NormalizedSafe(val7);
					Vec2 val9 = default(Vec2);
					((Vec2)(ref val9))..ctor(val8.x, val8.y * ((val8.y > 0L) ? ((Fix)2L) : ((Fix)1L)));
					__instance.body.AddForce(val9 * val2, (ForceMode2D)0);
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "trackingNade";

		public const string PLUGIN_NAME = "trackingNade";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}