Decompiled source of OopsAllKeys v1.0.0

OopsAllKeys.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("OopsAllKeys")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OopsAllKeys")]
[assembly: AssemblyTitle("OopsAllKeys")]
[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 OopsAllKeys
{
	[BepInPlugin("OopsAllKeys", "OopsAllKeys", "1.0.0")]
	public class OopsAllKeys : BaseUnityPlugin
	{
		public static Harmony harmony;

		public static ManualLogSource log;

		private void Awake()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin OopsAllKeys is loaded!");
			harmony = new Harmony("group.sc07.oopsallkeys");
			harmony.PatchAll();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "OopsAllKeys";

		public const string PLUGIN_NAME = "OopsAllKeys";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace OopsAllKeys.Patches
{
	[HarmonyPatch(typeof(RoundManager))]
	internal class RMPatches
	{
		[HarmonyPrefix]
		[HarmonyPatch("SpawnScrapInLevel")]
		public static bool SpawnScrapInLevel()
		{
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			Item val = StartOfRound.Instance.allItemsList.itemsList.Find((Item item) => item.itemName.ToLower() == "key");
			foreach (RandomScrapSpawn item in Object.FindObjectsOfType<RandomScrapSpawn>().ToList())
			{
				GameObject obj = Object.Instantiate<GameObject>(val.spawnPrefab, ((Component)item).transform.position + Vector3.up * 0.5f + Vector3.left * (float)Random.Range(-2, 2) + Vector3.forward * (float)Random.Range(-2, 2), Quaternion.identity, StartOfRound.Instance.propsContainer);
				obj.GetComponent<GrabbableObject>().fallTime = 0f;
				obj.GetComponent<NetworkObject>().Spawn(false);
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("LoadNewLevel")]
		private static void LoadNewLevel(int randomSeed, SelectableLevel newLevel)
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Expected O, but got Unknown
			OopsAllKeys.log.LogInfo((object)$"scrap to spawn {RoundManager.Instance.currentLevel.spawnableScrap.Count}");
			Item spawnableItem = StartOfRound.Instance.allItemsList.itemsList.Find((Item item) => item.itemName.ToLower() == "key");
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				_ = items;
			}
			RoundManager.Instance.currentLevel.spawnableScrap.Clear();
			for (int i = 0; i < 300; i++)
			{
				RoundManager.Instance.currentLevel.spawnableScrap.Add(new SpawnableItemWithRarity
				{
					rarity = 100,
					spawnableItem = spawnableItem
				});
			}
		}
	}
	[HarmonyPatch(typeof(RandomScrapSpawn))]
	internal class RSPPatches
	{
	}
}