Decompiled source of LethalStunGrenades v1.0.0

BepInEx/plugins/LethalStunGrenades.dll

Decompiled 5 days 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 BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using lethallobster.Patches;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalStunGrenades")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("LethalStunGrenades")]
[assembly: AssemblyTitle("LethalStunGrenades")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.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 lethallobster
{
	[BepInPlugin("pl.lethallobsterLethalStunGrenade", "LethalStunGrenade", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "pl.lethallobsterLethalStunGrenade";

		public const string modName = "LethalStunGrenade";

		public const string modVersion = "1.0.0";

		private Harmony harmony = new Harmony("pl.lethallobsterLethalStunGrenade");

		internal static ManualLogSource mls = Logger.CreateLogSource("pl.lethallobsterLethalStunGrenade");

		public static ConfigEntry<int> LethalStunPrice;

		private void Awake()
		{
			harmony.PatchAll(typeof(LethalStunGrenadePatch));
			harmony.PatchAll(typeof(TerminalPatch));
			LethalStunPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Balance", "LethalStunGrenadePrice", 80, "Price of the lethal stun grenade");
			mls.LogInfo((object)">>> Hello World <<<");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalStunGrenades";

		public const string PLUGIN_NAME = "LethalStunGrenades";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace lethallobster.Patches
{
	[HarmonyPatch(typeof(StunGrenadeItem))]
	[HarmonyPatch("ExplodeStunGrenade")]
	internal class LethalStunGrenadePatch
	{
		private static void Postfix(StunGrenadeItem __instance)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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)
			if (((NetworkBehaviour)__instance).IsServer && !(((object)__instance).GetType() != typeof(StunGrenadeItem)) && !(((GrabbableObject)__instance).itemProperties.itemName == "Easter egg") && !(((GrabbableObject)__instance).itemProperties.itemName != "Stun grenade") && !((Object)(object)((GrabbableObject)__instance).itemProperties == (Object)null) && !(((GrabbableObject)__instance).itemProperties.itemName != "Stun grenade"))
			{
				Vector3 position = ((Component)__instance).transform.position;
				Landmine.SpawnExplosion(position, true, 6f, 8f, 25, 0f, (GameObject)null, false);
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	[HarmonyPatch("Start")]
	internal class TerminalPatch
	{
		private static void Postfix(Terminal __instance)
		{
			Item[] buyableItemsList = __instance.buyableItemsList;
			foreach (Item val in buyableItemsList)
			{
				if (val.itemName == "Stun grenade")
				{
					val.creditsWorth = Plugin.LethalStunPrice.Value;
					break;
				}
			}
		}
	}
}