Decompiled source of MobDrops v1.3.0

MamboDancer-MobDrops/MobDrops.dll

Decompiled 4 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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: AssemblyTitle("PDCompany")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PDCompany")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fa3a75b0-12f3-4cfd-a9a8-cc13b24dcd46")]
[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 PDCompany
{
	[BepInPlugin("com.MamboDancer.MobDrops", "MobDrops", "1.3.0")]
	public class MobDropPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(HoarderBugAI))]
		private class PatchHoarderDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(HoarderBugAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(CentipedeAI))]
		private class PatchCentipedeDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(CentipedeAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(BaboonBirdAI))]
		private class PatchBaboonDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(BaboonBirdAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(CrawlerAI))]
		private class PatchCrawlerDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(CrawlerAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(DoublewingAI))]
		private class PatchDoublewingDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(DoublewingAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(FlowermanAI))]
		private class PatchFlowermanDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(FlowermanAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(ForestGiantAI))]
		private class PatchGiantDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(ForestGiantAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(MouthDogAI))]
		private class PatchDogDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(MouthDogAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(NutcrackerEnemyAI))]
		private class PatchNutcrackerDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(NutcrackerEnemyAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(PufferAI))]
		private class PatchPufferDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(PufferAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(SandSpiderAI))]
		private class PatchSpiderDrop
		{
			[HarmonyPatch("KillEnemy")]
			[HarmonyPostfix]
			private static void instantiateDrop(SandSpiderAI __instance)
			{
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = Object.Instantiate<GameObject>(sivr[Random.Range(0, sivr.Count)].spawnableItem.spawnPrefab, ((Component)__instance).GetComponent<Transform>().position, Quaternion.identity);
				GrabbableObject component = val.GetComponent<GrabbableObject>();
				component.fallTime = 0f;
				((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation);
				int num = Random.Range(75, 250);
				component.SetScrapValue(num);
				NetworkObject component2 = val.GetComponent<NetworkObject>();
				component2.Spawn(false);
				listOfNWR.Add(NetworkObjectReference.op_Implicit(component2));
				listOfScrapValues.Add(num);
				PatchDrops.syncScrap();
			}
		}

		[HarmonyPatch(typeof(RoundManager))]
		private class PatchDrops
		{
			private static RoundManager RM;

			[HarmonyPatch("SpawnScrapInLevel")]
			[HarmonyPrefix]
			private static void getScrap(ref SelectableLevel ___currentLevel, RoundManager __instance)
			{
				sivr = ___currentLevel.spawnableScrap;
				RM = __instance;
				Debug.Log((object)"Items loaded!");
			}

			public static void syncScrap()
			{
				RM.SyncScrapValuesClientRpc(listOfNWR.ToArray(), listOfScrapValues.ToArray());
			}
		}

		private static MobDropPlugin Instance;

		internal static AudioClip[] newSFX;

		private const string MyGUID = "com.MamboDancer.MobDrops";

		private const string PluginName = "MobDrops";

		private const string VersionString = "1.3.0";

		private static readonly Harmony Harmony = new Harmony("com.MamboDancer.MobDrops");

		public static ManualLogSource Log = new ManualLogSource("MobDrops");

		private static List<SpawnableItemWithRarity> sivr;

		private static List<NetworkObjectReference> listOfNWR = new List<NetworkObjectReference>();

		private static List<int> listOfScrapValues = new List<int>();

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod MobDrops, version of: 1.3.0 is loading...");
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod MobDrops, version of: 1.3.0 is successfully loaded. YAY");
			Log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
		}

		private void Start()
		{
		}

		private void Update()
		{
		}
	}
}
namespace PDCompany.Utils
{
	internal static class ModUtils
	{
	}
}
namespace PDCompany.Patches
{
	internal class PlayerPatches
	{
	}
}
namespace PDCompany.MonoBehaviours
{
	internal class PDCompanyComponent : MonoBehaviour
	{
		public void Awake()
		{
		}

		public void Start()
		{
		}

		public void Update()
		{
		}

		public void LateUpdate()
		{
		}
	}
}