Decompiled source of MoreMobs v1.0.0

MoreMobs.dll

Decompiled 4 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]
[assembly: AssemblyCompany("HoardingMania")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HoardingMania")]
[assembly: AssemblyTitle("HoardingMania")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[BepInPlugin("MoreMobs", "More Mobs", "1.0.0")]
public class ManEaterMania : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("com.moremobs.moremobs");
		val.PatchAll();
		Debug.Log((object)"[MOREMOBS] Successfully Initialized!");
	}

	public void LogInfo(string message)
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)message);
	}
}
[HarmonyPatch(typeof(RoundManager))]
[HarmonyPatch("SpawnEnemyOnServer")]
public static class SpawnEnemyOnServerPatch
{
	private static void Prefix(Vector3 spawnPosition, float yRot, int enemyNumber = -1)
	{
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"[MOREMOBS] Spawn Function Called!");
		for (int i = 0; i <= 7; i++)
		{
			Debug.Log((object)("[MOREMOBS] Spawned Entity " + i + " Times!"));
			if (((NetworkBehaviour)RoundManager.Instance).IsServer)
			{
				RoundManager.Instance.SpawnEnemyServerRpc(spawnPosition, yRot, enemyNumber);
			}
			RoundManager.Instance.SpawnEnemyGameObject(spawnPosition, yRot, enemyNumber, (EnemyType)null);
		}
	}
}
public static class SpawnEnemyGameObjectPatch
{
	private static NetworkObjectReference Prefix(Vector3 spawnPosition, float yRot, int enemyNumber, EnemyType enemyType = null)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: Unknown result type (might be due to invalid IL or missing references)
		//IL_0299: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: Unknown result type (might be due to invalid IL or missing references)
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0147: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_018c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_023b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0280: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0218: Unknown result type (might be due to invalid IL or missing references)
		//IL_021d: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"[MOREMOBS] Spawn Function Called!");
		RoundManager instance = RoundManager.Instance;
		NetworkObjectReference result = default(NetworkObjectReference);
		for (int i = 0; i < 8; i++)
		{
			Debug.Log((object)("[MOREMOBS] Spawned Entity " + i + " Times!"));
			if (!((NetworkBehaviour)instance).IsServer)
			{
				return NetworkObjectReference.op_Implicit(instance.currentLevel.Enemies[0].enemyType.enemyPrefab.GetComponent<NetworkObject>());
			}
			if ((Object)(object)enemyType != (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(enemyType.enemyPrefab, spawnPosition, Quaternion.Euler(new Vector3(0f, yRot, 0f)));
				val.GetComponentInChildren<NetworkObject>().Spawn(true);
				instance.SpawnedEnemies.Add(val.GetComponent<EnemyAI>());
				result = NetworkObjectReference.op_Implicit(val.GetComponentInChildren<NetworkObject>());
				continue;
			}
			int num = enemyNumber;
			switch (enemyNumber)
			{
			case -1:
				num = Random.Range(0, instance.currentLevel.Enemies.Count);
				break;
			case -2:
			{
				GameObject val3 = Object.Instantiate<GameObject>(instance.currentLevel.DaytimeEnemies[Random.Range(0, instance.currentLevel.DaytimeEnemies.Count)].enemyType.enemyPrefab, spawnPosition, Quaternion.Euler(new Vector3(0f, yRot, 0f)));
				val3.GetComponentInChildren<NetworkObject>().Spawn(true);
				instance.SpawnedEnemies.Add(val3.GetComponent<EnemyAI>());
				result = NetworkObjectReference.op_Implicit(val3.GetComponentInChildren<NetworkObject>());
				continue;
			}
			case -3:
			{
				GameObject val2 = Object.Instantiate<GameObject>(instance.currentLevel.OutsideEnemies[Random.Range(0, instance.currentLevel.OutsideEnemies.Count)].enemyType.enemyPrefab, spawnPosition, Quaternion.Euler(new Vector3(0f, yRot, 0f)));
				val2.GetComponentInChildren<NetworkObject>().Spawn(true);
				instance.SpawnedEnemies.Add(val2.GetComponent<EnemyAI>());
				result = NetworkObjectReference.op_Implicit(val2.GetComponentInChildren<NetworkObject>());
				continue;
			}
			}
			GameObject val4 = Object.Instantiate<GameObject>(instance.currentLevel.Enemies[num].enemyType.enemyPrefab, spawnPosition, Quaternion.Euler(new Vector3(0f, yRot, 0f)));
			val4.GetComponentInChildren<NetworkObject>().Spawn(true);
			instance.SpawnedEnemies.Add(val4.GetComponent<EnemyAI>());
			result = NetworkObjectReference.op_Implicit(val4.GetComponentInChildren<NetworkObject>());
		}
		return result;
	}
}