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 KeepEnemyPower v1.0.81
BepInEx/plugins/KeepEnemyPower.dll
Decompiled a week agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using KeepEnemyPower.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: ComVisible(false)] [assembly: Guid("54c69e4e-8e9f-4718-8342-958f866d451e")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")] [assembly: AssemblyCompany("KeepEnemyPower")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7091d167f8b9309906d49bc2423d9228c5706f80")] [assembly: AssemblyProduct("KeepEnemyPower")] [assembly: AssemblyTitle("KeepEnemyPower")] [assembly: AssemblyVersion("1.0.0.0")] namespace KeepEnemyPower { [BepInPlugin("JS03.KeepEnemyPower", "Keep Enemy Power", "1.0.81")] public class Plugin : BaseUnityPlugin { private const string modGUID = "JS03.KeepEnemyPower"; private const string modName = "Keep Enemy Power"; private const string modVersion = "1.0.81"; public static ConfigEntry<bool> keepIndoorsPower; public static ConfigEntry<bool> keepOutdoorsPower; private readonly Harmony harmony = new Harmony("JS03.KeepEnemyPower"); private static Plugin Instance; internal static ManualLogSource mls; private void Awake() { mls = Logger.CreateLogSource("JS03.KeepEnemyPower"); mls.LogInfo((object)"Keep Enemy Power active"); GenerateConfigValues(); harmony.PatchAll(typeof(EnemyAIPatch)); } internal void GenerateConfigValues() { keepIndoorsPower = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Keep Indoors Power", true, "Keeps the indoor enemy power when an indoor enemy dies"); keepOutdoorsPower = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Keep Outdoors Power", true, "Keeps the outdoor enemy power when an outdoor enemy dies"); } } } namespace KeepEnemyPower.Patches { [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatch { [HarmonyPatch("SubtractFromPowerLevel")] [HarmonyPrefix] private static void CheckPreviousPower(EnemyAI __instance, ref bool ___removedPowerLevel) { if (!___removedPowerLevel) { if (__instance.enemyType.isDaytimeEnemy) { Plugin.mls.LogInfo((object)("Previous Daytime Enemy Power -> " + RoundManager.Instance.currentDaytimeEnemyPower)); } else if (__instance.isOutside) { Plugin.mls.LogInfo((object)("Previous Outside Enemy Power -> " + RoundManager.Instance.currentOutsideEnemyPower)); } else { Plugin.mls.LogInfo((object)("Previous Inside Enemy Power -> " + RoundManager.Instance.currentEnemyPower)); } } } [HarmonyPatch("SubtractFromPowerLevel")] [HarmonyPostfix] private static void KeepPowerLevel(EnemyAI __instance, ref bool ___removedPowerLevel) { if (!___removedPowerLevel) { return; } if (__instance.enemyType.isDaytimeEnemy) { if (Plugin.keepOutdoorsPower.Value) { ___removedPowerLevel = false; RoundManager.Instance.currentDaytimeEnemyPower = Mathf.Max(RoundManager.Instance.currentDaytimeEnemyPower + __instance.enemyType.PowerLevel, 0f); } Plugin.mls.LogInfo((object)("Current Daytime Enemy Power -> " + RoundManager.Instance.currentDaytimeEnemyPower)); } else if (__instance.isOutside) { if (Plugin.keepOutdoorsPower.Value) { ___removedPowerLevel = false; RoundManager.Instance.currentOutsideEnemyPower = Mathf.Max(RoundManager.Instance.currentOutsideEnemyPower + __instance.enemyType.PowerLevel, 0f); } Plugin.mls.LogInfo((object)("Current Outside Enemy Power -> " + RoundManager.Instance.currentOutsideEnemyPower)); } else { if (Plugin.keepIndoorsPower.Value) { ___removedPowerLevel = false; RoundManager.Instance.currentEnemyPower = Mathf.Max(RoundManager.Instance.currentEnemyPower + __instance.enemyType.PowerLevel, 0f); } Plugin.mls.LogInfo((object)("Current Inside Enemy Power -> " + RoundManager.Instance.currentEnemyPower)); } } } }