Decompiled source of Lethal Nutcrackers v1.0.1

BepInEx/plugins/LethalNutcrackers.dll

Decompiled 6 months 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalNutcrackers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("A mod that makes nutcrackers spawn at march")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("LethalNutcrackers")]
[assembly: AssemblyTitle("LethalNutcrackers")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.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 LethalNutcrackers
{
	[BepInPlugin("LethalNutcrackers", "LethalNutcrackers", "1.1.0")]
	public class LethalNutcrackersBase : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("LethalNutcrackers");

		private static ConfigEntry<int> Entity;

		private void Awake()
		{
			if (Entity == null)
			{
				Entity = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "EntityID", 9, (ConfigDescription)null);
			}
			harmony.PatchAll(typeof(LethalNutcrackersBase));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalNutcrackers Patches Complete!, 1 Function Patched.");
		}

		[HarmonyPatch(typeof(StartOfRound), "StartGame")]
		[HarmonyPostfix]
		private static void SpawnNutcracker()
		{
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost && !(RoundManager.Instance.currentLevel.PlanetName != "61 March"))
			{
				RoundManager.Instance.SpawnEnemyServerRpc(new Vector3(-4.3f, -219.5f, 66f), 0f, Entity.Value);
			}
		}

		[HarmonyPatch(typeof(HUDManager), "Awake")]
		[HarmonyPostfix]
		private static void AlertPlayer(ref TextMeshProUGUI ___deviceChangeText, ref Animator ___deviceChangeAnimator)
		{
			((TMP_Text)___deviceChangeText).text = "LethalNutcrackers v1.1.0 Loaded";
			___deviceChangeAnimator.SetTrigger("display");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalNutcrackers";

		public const string PLUGIN_NAME = "LethalNutcrackers";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}