Decompiled source of NoHorn v1.0.0

NoHorn.dll

Decompiled a year ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using NoHorn.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: AssemblyTitle("NoHorn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NoHorn")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a6594b43-ca2b-491c-b3dd-9ee881542a75")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace NoHorn
{
	[BepInPlugin("Poseidon.NoHorn", "No Loud Horn", "1.0.0")]
	public class NoHornBase : BaseUnityPlugin
	{
		private const string modGUID = "Poseidon.NoHorn";

		private const string modName = "No Loud Horn";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Poseidon.NoHorn");

		private static NoHornBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Poseidon.NoHorn");
			mls.LogInfo((object)"The No Horn mod is online");
			harmony.PatchAll(typeof(NoHornBase));
			harmony.PatchAll(typeof(ShipAlarmCordPatch));
		}
	}
}
namespace NoHorn.Patches
{
	[HarmonyPatch(typeof(ShipAlarmCord))]
	internal class ShipAlarmCordPatch
	{
		private static Random random = new Random();

		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void hornCheckPatch(ref bool ___localClientHoldingCord)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			if (___localClientHoldingCord && random.Next(0, 1000) == 2)
			{
				PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
				localPlayerController.DamagePlayer(100, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
			}
		}
	}
}