Decompiled source of Rundown 0 v1.6.0

plugins/ExploGrenade/GrenadeTest.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AIGraph;
using AssetShards;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using FX_EffectSystem;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GrenadeTest")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GrenadeTest")]
[assembly: AssemblyTitle("GrenadeTest")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace GrenadeEnhancer
{
	[BepInPlugin("randomguy.ExploGrenade", "ExploGrenade", "1.0.0")]
	public class Plugin : BasePlugin
	{
		public static FX_Pool MineExplosionPool;

		internal static Plugin Instance;

		public override void Load()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((BasePlugin)this).Log.LogInfo((object)"ExploGrenade Loaded!");
			new Harmony("randomguy.ExploGrenade").PatchAll();
		}

		public static void EnsureExplosionPoolLoaded()
		{
			if ((Object)(object)MineExplosionPool != (Object)null)
			{
				return;
			}
			try
			{
				GameObject loadedAsset = AssetShardManager.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/FX_Effects/FX_Tripmine.prefab", false);
				if ((Object)(object)loadedAsset != (Object)null)
				{
					MineExplosionPool = FX_Manager.GetEffectPool(loadedAsset);
				}
			}
			catch (Exception)
			{
			}
		}

		public Plugin()
		{
			Instance = this;
		}
	}
	[HarmonyPatch(typeof(GrenadeBase))]
	internal static class GrenadeBasePatches
	{
		[HarmonyPostfix]
		[HarmonyPatch("Awake")]
		private static void Patch_Grenade_Awake(GrenadeBase __instance)
		{
			__instance.m_grenadeMaxDamage = 50;
		}

		[HarmonyPostfix]
		[HarmonyPatch("GrenadeDelay")]
		private static void Patch_Grenade_GrenadeDelay(GrenadeBase __instance)
		{
			//IL_004d: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			Plugin.EnsureExplosionPoolLoaded();
			if ((Object)(object)Plugin.MineExplosionPool != (Object)null)
			{
				FX_EffectBase_Poolable val = Plugin.MineExplosionPool.AquireEffect();
				if ((Object)(object)val != (Object)null)
				{
					Vector3 position = ((Component)__instance).transform.position;
					Quaternion val2 = Quaternion.LookRotation(Vector3.up);
					((FX_EffectBase)val).Play((FX_Trigger)null, position, val2);
				}
			}
			AIG_CourseNode val3 = default(AIG_CourseNode);
			if (AIG_CourseNode.TryGetCourseNode((eDimensionIndex)0, ((Component)__instance).transform.position, 1f, ref val3) && val3 != null)
			{
				NoiseManager.MakeNoise(new NM_NoiseData
				{
					noiseMaker = null,
					node = val3,
					position = ((Component)__instance).transform.position,
					radiusMin = 0f,
					radiusMax = 64f,
					yScale = 1f,
					type = (NM_NoiseType)0,
					includeToNeightbourAreas = false,
					raycastFirstNode = false
				});
			}
		}
	}
}