Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BreedingTweaks v1.0.0
BreedingTweaks.dll
Decompiled 2 years agousing System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Utils; 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("BreedingTweaks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BreedingTweaks")] [assembly: AssemblyCopyright("Copyright © 2021")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] namespace BreedingTweaks; public static class Configs { public static ConfigEntry<int> ChanceForOneLevelHigher; public static ConfigEntry<int> MaxCreatureLevel; public static ConfigEntry<int> MaxCreaturesCount; public static ConfigurationManagerAttributes IsAdminOnly = new ConfigurationManagerAttributes { IsAdminOnly = true }; public static void SetupConfigs(ConfigFile config) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown ChanceForOneLevelHigher = config.Bind<int>("General", GenerateConfigKey("ChanceForOneLevelHigher", "%"), 10, new ConfigDescription("Determines the chance that a new born offspring will be at one level higher than its parent. Vanilla default value = 0%.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), new object[1] { IsAdminOnly })); MaxCreatureLevel = config.Bind<int>("General", GenerateConfigKey("MaxCreatureLevel"), 3, new ConfigDescription("Determines the maximum level of a new born offspring. Vanilla default value = 3 (2 stars).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 20), new object[1] { IsAdminOnly })); MaxCreaturesCount = config.Bind<int>("General", GenerateConfigKey("MaxCreaturesCount"), 8, new ConfigDescription("Determines the maximum amount of creatures per cubic space. Vanilla default value = 4.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 40), new object[1] { IsAdminOnly })); } public static string GenerateConfigKey(string key) { return GenerateConfigKey(key, null); } public static string GenerateConfigKey(string key, string unit) { key = string.Concat(key.Select((char x) => char.IsUpper(x) ? (" " + x) : x.ToString())).TrimStart(new char[1] { ' ' }); if (!string.IsNullOrEmpty(unit)) { key += $" ({unit})"; } return key; } public static ConfigurationManagerAttributes SetOrder(int order, bool isAdminOnly = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown return new ConfigurationManagerAttributes { Order = order, IsAdminOnly = isAdminOnly }; } } [BepInPlugin("BreedingTweaks", "BreedingTweaks", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class BreedingTweaks : BaseUnityPlugin { [HarmonyPatch(typeof(Procreation), "Awake")] public class Procreation_Awake_Patch { private static void Postfix(ref int ___m_maxCreatures) { if (Configs.MaxCreaturesCount.Value != 4) { ___m_maxCreatures = Configs.MaxCreaturesCount.Value; } } } [HarmonyPatch(typeof(Procreation), "Procreate")] public class Procreation_Procreate_Patch { private static int storedMinOffspringLevel; private static void Prefix(Character ___m_character, ref int ___m_minOffspringLevel) { if (Configs.ChanceForOneLevelHigher.Value != 0) { storedMinOffspringLevel = ___m_minOffspringLevel; int level = ___m_character.GetLevel(); if (level < Configs.MaxCreatureLevel.Value && Random.Range(0f, 1f) <= (float)Configs.ChanceForOneLevelHigher.Value / 100f) { ___m_minOffspringLevel = level + 1; } } } private static void Postfix(ref int ___m_minOffspringLevel) { if (Configs.ChanceForOneLevelHigher.Value != 0) { ___m_minOffspringLevel = storedMinOffspringLevel; } } } public const string PluginGUID = "BreedingTweaks"; public const string PluginName = "BreedingTweaks"; public const string PluginVersion = "1.0.0"; private static Harmony harmony; private void Awake() { Configs.SetupConfigs(((BaseUnityPlugin)this).Config); harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "BreedingTweaks"); } private void OnDestroy() { Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } }