Decompiled source of Cursed Scrap v0.1.0

BepInEx/plugins/com.github.kyngnoodle.cursed_scrap.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
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;

[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Lordfirespeed, KyngNoodle, Zilli")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Only allows cursed scrap to spawn.")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+bfeec83393f7c8704ee97d0b1c5ae0afe46cc6cb")]
[assembly: AssemblyProduct("Cursed Scrap")]
[assembly: AssemblyTitle("com.github.kyngnoodle.cursed_scrap")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/Lordfirespeed/Lethal-Company-KyngNoodle-Cursed_Scrap_Mod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 CursedScrap
{
	[BepInPlugin("com.github.kyngnoodle.cursed_scrap", "Cursed Scrap", "0.1.0")]
	public class CursedScrapPlugin : BaseUnityPlugin
	{
		private class CursedPatches
		{
			[HarmonyPatch(typeof(RoundManager), "Awake")]
			[HarmonyPrefix]
			public static void RemoveNotSillyScraps(RoundManager __instance)
			{
				Logger.LogInfo((object)"Doing the cursed scrap...");
				SelectableLevel val = __instance.playersManager.levels.First((SelectableLevel level) => level.PlanetName == "41 Experimentation");
				Logger.LogInfo((object)$"Found experimentation moon {val}");
				List<SpawnableItemWithRarity> sillyScraps = val.spawnableScrap.Where(delegate(SpawnableItemWithRarity scrap)
				{
					string itemName = scrap.spawnableItem.itemName;
					return (itemName == "Jar of pickles" || itemName == "Bottles") ? true : false;
				}).Select(delegate(SpawnableItemWithRarity scrap)
				{
					scrap.rarity = (scrap.spawnableItem.twoHanded ? 1 : 3);
					return scrap;
				}).ToList();
				Logger.LogInfo((object)$"Found {sillyScraps.Count} scraps");
				CollectionExtensions.Do<SelectableLevel>((IEnumerable<SelectableLevel>)__instance.playersManager.levels, (Action<SelectableLevel>)delegate(SelectableLevel level)
				{
					level.spawnableScrap = sillyScraps;
				});
			}
		}

		internal static ManualLogSource Logger;

		public CursedScrapPlugin()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
		}

		public 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.github.kyngnoodle.cursed_scrap");
			val.PatchAll(typeof(CursedPatches));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.kyngnoodle.cursed_scrap";

		public const string PLUGIN_NAME = "Cursed Scrap";

		public const string PLUGIN_VERSION = "0.1.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}