Decompiled source of NoSmoking v1.0.1

NoSmoking.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Linq;
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 GameNetcodeStuff;
using HarmonyLib;
using LethalCasino.Custom;
using Microsoft.CodeAnalysis;
using NoSmoking.Patches;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NoSmoking")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A template for Lethal Company")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+40f01535106a80ab2e971303fc7711da1b4b39f5")]
[assembly: AssemblyProduct("NoSmoking")]
[assembly: AssemblyTitle("NoSmoking")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 NoSmoking
{
	public class Config
	{
		public static ConfigEntry<string> Players;

		public static string[] CheaterUsernames;

		public Config(ConfigFile configFile)
		{
			Players = configFile.Bind<string>("General", "Players", string.Empty, "Who you want to kill (Example value: Player 1;Player 2)");
			CheaterUsernames = Players.Value.ToString().Split(';');
		}
	}
	[BepInPlugin("NoSmoking", "NoSmoking", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("NoSmoking");

		internal static ManualLogSource customLogger;

		public static ConfigFile StaticConfig;

		internal static Config BoundConfig { get; private set; }

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin NoSmoking is loaded!");
			StaticConfig = ((BaseUnityPlugin)this).Config;
			BoundConfig = new Config(StaticConfig);
			customLogger = Logger.CreateLogSource("NoSmoking");
			harmony.PatchAll(typeof(SmokingPipePatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NoSmoking";

		public const string PLUGIN_NAME = "NoSmoking";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}
namespace NoSmoking.Patches
{
	internal class SmokingPipePatch
	{
		[HarmonyPatch(typeof(SmokingPipe), "ItemActivate")]
		[HarmonyPostfix]
		internal static void KillCheater()
		{
			//IL_0042: 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)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			Plugin.customLogger.LogInfo((object)"Finding cheaters...");
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			if (Config.CheaterUsernames.Contains(localPlayerController.playerUsername))
			{
				Plugin.customLogger.LogInfo((object)"Killed cheater");
				localPlayerController.KillPlayer(Vector3.zero, true, (CauseOfDeath)0, 0, default(Vector3));
			}
		}
	}
}