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 PowersConfigurator v1.0.2
PowersConfigurator.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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 ServerSync; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("PowersConfigurator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PowersConfigurator")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a0b75ab7-b527-489e-ba01-050120bb7a51")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.2.0")] namespace PowersConfigurator; internal static class PowerFinder { public static BossPowerConfigEntry<float> GetFlagsForBoss(BossIds bossId) { BossPowerConfigEntry<float> bossPowerConfigEntry = new BossPowerConfigEntry<float> { Duration = PowersConfiguratorMod.Vanilla_TtlSec, Cooldown = PowersConfiguratorMod.Vanilla_CooldownSec }; if (PowersConfiguratorMod.ModConfig[bossId] != null) { bossPowerConfigEntry.Cooldown = PowersConfiguratorMod.ModConfig[bossId].Cooldown.Value; bossPowerConfigEntry.Duration = PowersConfiguratorMod.ModConfig[bossId].Duration.Value; } else { PowersConfiguratorMod.ModLogger.LogError((object)$"No data for \"{bossId}\""); bossPowerConfigEntry.Cooldown = PowersConfiguratorMod.DefaultCooldown.Value; bossPowerConfigEntry.Duration = PowersConfiguratorMod.DefaultDuration.Value; } return bossPowerConfigEntry; } public static BossIds StatusNameToBossId(string statusName) { switch (statusName) { case "GP_Eikthyr": return BossIds.Eikthyr; case "GP_TheElder": return BossIds.Elder; case "GP_Bonemass": return BossIds.Bonemass; case "GP_Moder": return BossIds.Moder; case "GP_Yagluth": return BossIds.Yagluth; case "GP_Queen": return BossIds.Queen; case "GP_Ashlands": case "GP_Fader": return BossIds.Fader; default: Debug.Log((object)("Unknown Guardian Power: \"" + (statusName ?? "none") + "\"")); return BossIds.Global; } } } [HarmonyPatch(typeof(Player), "ActivateGuardianPower")] internal static class ActivatePower_Patch { private static void Prefix(Player __instance, StatusEffect ___m_guardianSE) { Debug.Log((object)"Prefix ActivateGuardianPower"); if (!((Object)(object)___m_guardianSE == (Object)null)) { BossIds num = PowerFinder.StatusNameToBossId(((Object)___m_guardianSE).name); BossPowerConfigEntry<float> flagsForBoss = PowerFinder.GetFlagsForBoss(num); Debug.Log((object)num); Debug.Log((object)flagsForBoss.Cooldown); Debug.Log((object)"/Prefix"); ___m_guardianSE.m_cooldown = flagsForBoss.Cooldown; ___m_guardianSE.m_ttl = flagsForBoss.Duration; } } } [HarmonyPatch(typeof(Player), "SetGuardianPower")] internal static class SetPower_Patch { private static void Postfix(Player __instance, StatusEffect ___m_guardianSE) { Debug.Log((object)"Postfix SetGuardianPower"); if (!((Object)(object)___m_guardianSE == (Object)null)) { BossIds num = PowerFinder.StatusNameToBossId(((Object)___m_guardianSE).name); BossPowerConfigEntry<float> flagsForBoss = PowerFinder.GetFlagsForBoss(num); Debug.Log((object)num); Debug.Log((object)flagsForBoss.Cooldown); Debug.Log((object)"/Postfix"); ___m_guardianSE.m_cooldown = flagsForBoss.Cooldown; ___m_guardianSE.m_ttl = flagsForBoss.Duration; } } } [BepInPlugin("fibrechips.PowersConfigurator", "Powers Configurator", "1.0.2")] public class PowersConfiguratorMod : BaseUnityPlugin { internal const string ModName = "Powers Configurator"; internal const string ModVersion = "1.0.2"; internal const string Author = "FibreChips"; private readonly Harmony harmony = new Harmony("FibreChips.Powers Configurator"); private const string ModGUID = "FibreChips.Powers Configurator"; private static readonly string ConfigFileName = "FibreChips.Powers Configurator.cfg"; private static readonly string ConfigFileFullPath; public static readonly ManualLogSource ModLogger; private static readonly ConfigSync ConfigSync; public static readonly float Vanilla_CooldownSec; public static readonly float Vanilla_TtlSec; private static ConfigEntry<bool> _serverConfigLocked; public static ConfigEntry<float> DefaultCooldown; public static ConfigEntry<float> DefaultDuration; public static ConfigEntry<float> DefaultMultiplier; public static Dictionary<BossIds, BossPowerConfigEntry<ConfigEntry<float>>> ModConfig { get; set; } private void Awake() { _serverConfigLocked = ConfigOpt("99 - ServerSync", "Lock Configuration", defaultValue: true, "If on, the configuration is locked and can be changed by server admins only."); ConfigSync.AddLockingConfigEntry<bool>(_serverConfigLocked); ModLogger.LogInfo((object)$"Is Config source of truth: {ConfigSync.IsSourceOfTruth}"); int num = 0; foreach (BossIds value in Enum.GetValues(typeof(BossIds))) { string name = Enum.GetName(typeof(BossIds), value); ModConfig.Add(value, new BossPowerConfigEntry<ConfigEntry<float>> { Cooldown = ConfigOpt($"{num} - {name}", name + " Cooldown", Vanilla_CooldownSec, name + " Cooldown (seconds)"), Duration = ConfigOpt($"{num} - {name}", name + " Duration", Vanilla_TtlSec, name + " Duration (seconds)") }); num++; } Assembly executingAssembly = Assembly.GetExecutingAssembly(); harmony.PatchAll(executingAssembly); ((BaseUnityPlugin)this).Config.Save(); SetupWatcher(); } private void OnDestroy() { ((BaseUnityPlugin)this).Config.Save(); harmony.UnpatchSelf(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { ((BaseUnityPlugin)this).Config.Reload(); } catch { ModLogger.LogError((object)("Error reading " + ConfigFileName)); } } private ConfigEntry<T> ConfigOpt<T>(string group, string name, T defaultValue, ConfigDescription description, bool synchronizedSetting = true) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ConfigDescription val = new ConfigDescription(description.Description + (synchronizedSetting ? " [Synced with Server]" : " [Not Synced with Server]"), description.AcceptableValues, description.Tags); ConfigEntry<T> val2 = ((BaseUnityPlugin)this).Config.Bind<T>(group, name, defaultValue, val); ((OwnConfigEntryBase)ConfigSync.AddConfigEntry<T>(val2)).SynchronizedConfig = synchronizedSetting; return val2; } private ConfigEntry<T> ConfigOpt<T>(string group, string name, T defaultValue, string description, bool synchronizedSetting = true) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown return ConfigOpt(group, name, defaultValue, new ConfigDescription(description, (AcceptableValueBase)null, Array.Empty<object>()), synchronizedSetting); } static PowersConfiguratorMod() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; ModLogger = Logger.CreateLogSource("Powers Configurator"); ConfigSync = new ConfigSync("FibreChips.Powers Configurator") { DisplayName = "Powers Configurator", CurrentVersion = "1.0.2", MinimumRequiredVersion = "1.0.2", ModRequired = false }; Vanilla_CooldownSec = 1200f; Vanilla_TtlSec = 300f; _serverConfigLocked = null; ModConfig = new Dictionary<BossIds, BossPowerConfigEntry<ConfigEntry<float>>>(); } } public enum BossIds { Global, Eikthyr, Elder, Bonemass, Moder, Yagluth, Queen, Fader } public class BossPowerConfigEntry<T> { public T Duration { get; set; } public T Cooldown { get; set; } }