Please disclose if any significant portion of your mod was created 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 MonsterMayhem v0.1.1
plugins/MonsterMayhem/MonsterMayhem.dll
Decompiled 11 months agousing 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 System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; 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("MonsterMayhem")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Cool mod.")] [assembly: AssemblyFileVersion("0.1.1.0")] [assembly: AssemblyInformationalVersion("0.1.1")] [assembly: AssemblyProduct("MonsterMayhem")] [assembly: AssemblyTitle("MonsterMayhem")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.1.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 MonsterMayhem { public static class MyPluginInfo { public const string PLUGIN_GUID = "MonsterMayhem"; public const string PLUGIN_NAME = "MonsterMayhem"; public const string PLUGIN_VERSION = "0.1.1"; } } namespace MonsterMayhem.src { public class MonsterMayhemConfig { public ConfigEntry<bool> ConfigExtendedLogging { get; private set; } public ConfigEntry<string> ConfigEnemyToSpawn { get; private set; } public void InitMonsterMayhemConfig(ConfigFile configFile) { ConfigExtendedLogging = configFile.Bind<bool>("Debug Options", "Debug Mode | Extended Logging", false, "Whether ExtendedLogging is enabled."); ConfigEnemyToSpawn = configFile.Bind<string>("Monster Options", "Enemy To Spawn", "Enemy Group - 10 Gnomes", "The name of the enemy to replace all other enemies with, defaulted to a gnome cluster (not case sensitive)."); } } [BepInPlugin("MonsterMayhem", "MonsterMayhem", "0.1.1")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger = null; internal static readonly Harmony _harmony = new Harmony("MonsterMayhem"); internal static readonly Dictionary<string, AssetBundle> LoadedBundles = new Dictionary<string, AssetBundle>(); internal static ConfigFile ConfigFile { get; private set; } = null; public static MonsterMayhemConfig ModConfig { get; private set; } = null; public void Awake() { Logger = ((BaseUnityPlugin)this).Logger; ConfigFile = ((BaseUnityPlugin)this).Config; ModConfig = new MonsterMayhemConfig(); ModConfig.InitMonsterMayhemConfig(ConfigFile); ((BaseUnityPlugin)this).Config.Save(); Logger.LogInfo((object)"Registering MonsterMayhem content."); _harmony.PatchAll(); Logger.LogInfo((object)"Plugin MonsterMayhem is loaded!"); } private void OnDisable() { foreach (AssetBundle value in LoadedBundles.Values) { value.Unload(false); } Logger.LogDebug((object)"Unloaded assetbundles."); LoadedBundles.Clear(); } internal static void ExtendedLogging(object text) { if (ModConfig.ConfigExtendedLogging.Value) { Logger.LogInfo(text); } } } } namespace MonsterMayhem.src.Util.Extensions { public static class ConfigFileExtensions { internal static void ClearUnusedEntries(this ConfigFile configFile) { PropertyInfo property = ((object)configFile).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(configFile, null); dictionary.Clear(); configFile.Save(); } } public static class RandomExtensions { public static T NextEnum<T>(this Random random) where T : struct, Enum { Array values = Enum.GetValues(typeof(T)); return (T)values.GetValue(random.Next(values.Length)); } public static T NextItem<T>(this Random random, List<T> collection) { int index = random.Next(collection.Count); return collection[index]; } public static T NextItem<T>(this Random random, T[] collection) { int num = random.Next(collection.Length); return collection[num]; } public static double NextDouble(this Random random, double min, double max) { return random.NextDouble() * (max - min) + min; } public static float NextFloat(this Random random, float min, float max) { return (float)random.NextDouble(min, max); } public static bool NextBool(this Random random) { return random.Next(2) == 0; } public static int NextSign(this Random random) { if (!random.NextBool()) { return -1; } return 1; } public static Quaternion NextQuaternion(this Random random) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) return Quaternion.Euler(random.NextFloat(0f, 360f), random.NextFloat(0f, 360f), random.NextFloat(0f, 360f)); } } internal static class StringExtensions { private static readonly Regex ConfigCleanerRegex = new Regex("[\\n\\t\"`\\[\\]']"); public static string OrIfEmpty(this string? self, string defaultValue) { if (string.IsNullOrEmpty(self)) { return defaultValue; } return self; } public static string FirstCharToUpper(this string input) { if (string.IsNullOrEmpty(input)) { throw new ArgumentException("ARGH!"); } return input.First().ToString().ToUpper() + input.Substring(1, input.Length - 1); } public static string CleanStringForConfig(this string input) { return ConfigCleanerRegex.Replace(input, string.Empty); } } } namespace MonsterMayhem.src.Patches { [HarmonyPatch(typeof(EnemyDirector))] public static class EnemyDirectorPatch { [HarmonyPatch("AmountSetup")] [HarmonyPrefix] public static void AmountSetupPatch(EnemyDirector __instance) { EnemySetup val = null; List<EnemySetup> list = __instance.enemiesDifficulty1.Concat(__instance.enemiesDifficulty2).Concat(__instance.enemiesDifficulty3).Distinct() .ToList(); foreach (EnemySetup item in list) { Plugin.ExtendedLogging("Comparing " + ((Object)item).name + " to " + Plugin.ModConfig.ConfigEnemyToSpawn.Value); if (((Object)item).name.Equals(Plugin.ModConfig.ConfigEnemyToSpawn.Value, StringComparison.OrdinalIgnoreCase)) { val = item; break; } } if ((Object)(object)val != (Object)null) { Plugin.ExtendedLogging("Found enemy to spawn: " + ((Object)val).name); __instance.enemiesDifficulty1.Clear(); __instance.enemiesDifficulty2.Clear(); __instance.enemiesDifficulty3.Clear(); __instance.enemiesDifficulty1.Add(val); __instance.enemiesDifficulty2.Add(val); __instance.enemiesDifficulty3.Add(val); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }