Decompiled source of NeedyCatsCustomMoons v1.0.0

NeedyCatsCustomMoons.dll

Decompiled 10 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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NeedyCats;

[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-CSharp")]
[assembly: AssemblyCompany("NeedyCatsCustomMoons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Add the cats from NeedyCats to all the custom moons")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NeedyCatsCustomMoons")]
[assembly: AssemblyTitle("NeedyCatsCustomMoons")]
[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 NeedyCatsCustomMoons
{
	internal class NeedyCatPatch
	{
		[HarmonyPatch(typeof(RoundManager), "Start")]
		[HarmonyPrefix]
		[HarmonyPriority(0)]
		private static void AddNeedyCatsToAllLevels_Prefix()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			Plugin.mls.LogMessage((object)"AddNeedyCatsToAllLevels_Prefix");
			Item item = Assets.MainAssetBundle.LoadAsset<Item>("CatItem");
			SpawnableItemWithRarity val = new SpawnableItemWithRarity();
			val.rarity = NeedyCatsCustomMoonsConfig.spawnRate.Value;
			val.spawnableItem = item;
			SelectableLevel[] levels = StartOfRound.Instance.levels;
			string text = "";
			string text2 = "";
			SelectableLevel[] array = levels;
			foreach (SelectableLevel val2 in array)
			{
				if (!val2.spawnableScrap.Any((SpawnableItemWithRarity x) => x.spawnableItem == item))
				{
					text = text + val2.PlanetName + ",";
					val2.spawnableScrap.Add(val);
				}
				else
				{
					text2 = text2 + val2.PlanetName + ",";
				}
			}
			Plugin.mls.LogMessage((object)("Added Needy Cats to all levels and custom moons. (added to: " + text + ") (already in: " + text2 + ")"));
		}
	}
	public class NeedyCatsCustomMoonsConfig
	{
		public static ConfigEntry<int> spawnRate;

		public NeedyCatsCustomMoonsConfig(ConfigFile cfg)
		{
			spawnRate = cfg.Bind<int>("General.Toggles", "Spawn rate", 20, "The spawn rate of the cats on all moons (override the setting in NeedyCats config)");
		}
	}
	[BepInPlugin("NeedyCatsCustomMoons", "NeedyCatsCustomMoons", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource mls;

		public static NeedyCatsCustomMoonsConfig NeedyCatsCustomMoonsConfig { get; internal set; }

		private void Awake()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			mls = Logger.CreateLogSource("AboveFire.NeedyCatsCustomMoons");
			NeedyCatsCustomMoonsConfig = new NeedyCatsCustomMoonsConfig(((BaseUnityPlugin)this).Config);
			Harmony val = new Harmony("NeedyCatsCustomMoons");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin NeedyCatsCustomMoons is loaded!");
			val.PatchAll(typeof(NeedyCatPatch));
			mls.LogMessage((object)"Initialized NeedyCatsCustomMoons");
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "NeedyCatsCustomMoons";

		public const string PLUGIN_NAME = "NeedyCatsCustomMoons";

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