Decompiled source of Lethal Hoarding Swarm v1.0.2

BepInEx/plugins/LethalHoardingSwarm.dll

Decompiled 10 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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalHoardingSwarm")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod that makes Hoarding Bug Swarms spawn at march")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LethalHoardingSwarm")]
[assembly: AssemblyTitle("LethalHoardingSwarm")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 LethalHoardingSwarm
{
	[BepInPlugin("LethalHoardingSwarm", "LethalHoardingSwarm", "1.0.0")]
	public class LethalHoardingSwarmBase : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("LethalHoardingSwarm");

		private static ConfigEntry<int> Entity;

		private static ConfigEntry<int> SwarmMin;

		private static ConfigEntry<int> SwarmMax;

		private void Awake()
		{
			if (Entity == null)
			{
				Entity = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "EntityID", 2, (ConfigDescription)null);
			}
			if (SwarmMin == null)
			{
				SwarmMin = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "SwarmMin Size", 10, (ConfigDescription)null);
			}
			if (SwarmMax == null)
			{
				SwarmMax = ((BaseUnityPlugin)this).Config.Bind<int>("Settings", "SwarmMax Size", 100, (ConfigDescription)null);
			}
			harmony.PatchAll(typeof(LethalHoardingSwarmBase));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalHoardingSwarm Successfuly Patched!, 2 Function Patched.");
		}

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

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

		public const string PLUGIN_NAME = "LethalHoardingSwarm";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}