Decompiled source of BoarBreedingUnlimited v1.1.0

plugins/BoarBreedingUnlimited.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("BoarBreedingUnlimited")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("BoarBreedingUnlimited")]
[assembly: AssemblyTitle("BoarBreedingUnlimited")]
[assembly: AssemblyVersion("1.1.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BoarBreedingUnlimited
{
	[BepInPlugin("com.honeymanmods.boarbreedingunlimited", "BoarBreedingUnlimited", "1.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "com.honeymanmods.boarbreedingunlimited";

		public const string PluginName = "BoarBreedingUnlimited";

		public const string PluginVersion = "1.1.0";

		internal static ConfigEntry<bool> LimitPopulation;

		internal static ConfigEntry<int> MaxCreatures;

		private Harmony _harmony;

		private void Awake()
		{
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			LimitPopulation = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "LimitPopulation", false, "false = unlimited breeding (no cap). true = animals stop breeding once MaxCreatures of the same species are nearby.");
			MaxCreatures = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxCreatures", 20, new ConfigDescription("Population cap per species in the local area. Only used when LimitPopulation = true. Vanilla is about 4. The parents count toward the cap, so 3 is the lowest value that still allows breeding. Recommended: 10-30. Above ~50 creatures in one spot you will likely notice lag.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(3, 100), Array.Empty<object>()));
			_harmony = new Harmony("com.honeymanmods.boarbreedingunlimited");
			_harmony.PatchAll();
			string text = (LimitPopulation.Value ? $"capped at {MaxCreatures.Value}" : "unlimited");
			((BaseUnityPlugin)this).Logger.LogInfo((object)("BoarBreedingUnlimited v1.1.0 loaded - breeding " + text + "."));
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	[HarmonyPatch(typeof(Procreation), "Procreate")]
	internal static class Procreation_Procreate_Patch
	{
		[HarmonyPrefix]
		private static void Prefix(Procreation __instance)
		{
			__instance.m_maxCreatures = (Plugin.LimitPopulation.Value ? Plugin.MaxCreatures.Value : int.MaxValue);
		}
	}
}