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 SupplementaryMines v1.1.0
SupplementaryMines.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using SupplementaryMines.Patches; using SupplementaryMines.config; using UnityEngine; [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 = "")] [assembly: AssemblyCompany("SupplementaryMines")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Lethal Company requires more explosives. Don't you agree?")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SupplementaryMines")] [assembly: AssemblyTitle("SupplementaryMines")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace SupplementaryMines { [BepInPlugin("SupplementaryMines", "SupplementaryMines", "1.0.0")] public class Plugin : BaseUnityPlugin { public static Plugin instance; private Harmony harmony = new Harmony("SupplementaryMines"); private void Awake() { instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SupplementaryMines is loaded!"); Config.Init(); Config.PrintConfig(); harmony.PatchAll(typeof(Plugin)); harmony.PatchAll(typeof(RoundManagerPatch)); } public static void Log(string message) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)message); } } public static class PluginInfo { public const string PLUGIN_GUID = "SupplementaryMines"; public const string PLUGIN_NAME = "SupplementaryMines"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace SupplementaryMines.Patches { [HarmonyPatch(typeof(RoundManager))] internal class RoundManagerPatch { public static RoundManagerPatch Instance; private void Awake() { if (Instance == null) { Instance = this; } } private static void PrintKeyframes(Keyframe[] keyframes) { for (int i = 0; i < keyframes.Length; i++) { Plugin.Log("PrintKeyframes: \n\tValue: " + ((Keyframe)(ref keyframes[i])).value + "\n\tTime: " + ((Keyframe)(ref keyframes[i])).time); } } [HarmonyPatch("SpawnMapObjects")] [HarmonyPrefix] private static void Prefix(RoundManager __instance) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) Plugin.Log("Prefix: Ran SpawnMapObjects"); for (int i = 0; i < __instance.currentLevel.spawnableMapObjects.Length; i++) { PrintKeyframes(__instance.currentLevel.spawnableMapObjects[i].numberToSpawn.GetKeys()); } Plugin.Log("Prefix: " + __instance.currentLevel.spawnableMapObjects); for (int j = 0; j < __instance.currentLevel.spawnableMapObjects.Length; j++) { SpawnableMapObject val = __instance.currentLevel.spawnableMapObjects[j]; Plugin.Log("Prefix: Found SpawnableMapObject prefab named \"" + ((Object)val.prefabToSpawn).name + "\""); if (((Object)val.prefabToSpawn).name == "Landmine") { Plugin.Log("Prefix: Found Landmine in \"currentLevel.spawnableMapObjects\"!"); Keyframe[] keys = val.numberToSpawn.GetKeys(); for (int k = 0; k < keys.Length; k++) { Keyframe val2 = keys[k]; keys.SetValue((object)new Keyframe(((Keyframe)(ref val2)).time, Math.Max(Config.consistentLandmines ? Config.landminesMinimum : 0f, val.numberToSpawn.Evaluate(((Keyframe)(ref val2)).time) * Config.landminesMultiplier)), k); __instance.currentLevel.spawnableMapObjects[j].numberToSpawn.SetKeys(keys); Plugin.Log("Prefix: Applied MinesModifier!"); } } } for (int l = 0; l < __instance.currentLevel.spawnableMapObjects.Length; l++) { PrintKeyframes(__instance.currentLevel.spawnableMapObjects[l].numberToSpawn.GetKeys()); } Plugin.Log("Prefix: Finished SpawnMapObjects"); } [HarmonyPatch("SpawnMapObjects")] [HarmonyPostfix] private static void Postfix(RoundManager __instance) { Plugin.Log("Postfix: Ran SpawnMapObjects"); Plugin.Log("Postfix: Finished SpawnMapObjects"); } } } namespace SupplementaryMines.config { internal static class Config { private const string CONFIG_FILE_NAME = "supplementary_mines.cfg"; private static ConfigFile _config; private static ConfigEntry<bool> _consistentLandmines; private static ConfigEntry<float> _landminesMultiplier; private static ConfigEntry<float> _landminesMinimum; public static bool consistentLandmines => _consistentLandmines.Value; public static float landminesMultiplier => _landminesMultiplier.Value; public static float landminesMinimum => _landminesMinimum.Value; public static void Init() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Plugin.Log("Initializing config..."); string text = Path.Combine(Paths.ConfigPath, "supplementary_mines.cfg"); _config = new ConfigFile(text, true); _consistentLandmines = _config.Bind<bool>("Config", "Consistent Landmines", false, "Every map will have mines in their spawn table."); _landminesMultiplier = _config.Bind<float>("Config", "Landmines Multiplier", 1f, "Multiplies the default amount of mines to spawn."); _landminesMinimum = _config.Bind<float>("Config", "Landmines Minimum", 1f, "[Only applies with Consistent Landmines turned on] The minimum amount of mines to spawn."); Plugin.Log("Config initialized!"); } public static void PrintConfig() { Plugin.Log($"Consistent Landmines: {consistentLandmines}"); Plugin.Log($"Landmines Multiplier: {landminesMultiplier}"); Plugin.Log($"Landmines Multiplier: {landminesMinimum}"); } } }