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 Nail1ATK v1.0.0
Nail-1-ATK.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using 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; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Nail-1-ATK")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Nail-1-ATK")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("3b1f0847-0dae-4581-9e47-74558da116d2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyVersion("1.0.0.0")] namespace nord.Nail1ATK; public abstract class ConfigManager { public enum Step { AWAKE, GAME_MAIN_BEGIN, STATE } private static ConfigManager instance; private static Dictionary<ConfigDefinition, string> orphanedEntries; public static ConfigFile Config { get; private set; } protected ConfigManager(ConfigFile config) { instance = this; Config = config; Config.SaveOnConfigSet = false; } public static void CheckConfig(Step step) { instance.CheckConfigImplements(step); } protected abstract void CheckConfigImplements(Step step); public static ConfigEntry<T> Bind<T>(ConfigDefinition configDefinition, T defaultValue, ConfigDescription configDescription = null) { return Config.Bind<T>(configDefinition, defaultValue, configDescription); } public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, ConfigDescription configDescription = null) { return Config.Bind<T>(section, key, defaultValue, configDescription); } public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description) { return Config.Bind<T>(section, key, defaultValue, description); } public static ConfigEntry<T> GetEntry<T>(ConfigDefinition configDefinition) { try { return (ConfigEntry<T>)(object)Config[configDefinition]; } catch (KeyNotFoundException ex) { LogManager.LogError($"{ex.GetType()}: configDefinition={configDefinition}"); throw; } } public static ConfigEntry<T> GetEntry<T>(string section, string key) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown return GetEntry<T>(new ConfigDefinition(section, key)); } public static T GetValue<T>(ConfigDefinition configDefinition) { return GetEntry<T>(configDefinition).Value; } public static T GetValue<T>(string section, string key) { return GetEntry<T>(section, key).Value; } public static bool ContainsKey(ConfigDefinition configDefinition) { return Config.ContainsKey(configDefinition); } public static bool ContainsKey(string section, string key) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown return Config.ContainsKey(new ConfigDefinition(section, key)); } public static bool UpdateEntry<T>(string section, string key, T value) where T : IComparable { ConfigEntry<T> entry = GetEntry<T>(section, key); if (entry.Value.CompareTo(value) == 0) { return false; } entry.Value = value; return true; } public static bool RemoveEntry(ConfigDefinition key) { return Config.Remove(key); } public static Dictionary<ConfigDefinition, string> GetOrphanedEntries() { if (orphanedEntries == null) { orphanedEntries = Traverse.Create((object)Config).Property<Dictionary<ConfigDefinition, string>>("OrphanedEntries", (object[])null).Value; } return orphanedEntries; } public static void Migration<T>(string newSection, string newKey, T defaultValue, string oldSection, string oldKey) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown GetOrphanedEntries(); ConfigDefinition key = new ConfigDefinition(oldSection, oldKey); if (orphanedEntries.TryGetValue(key, out var value)) { ((ConfigEntryBase)Bind(newSection, newKey, defaultValue)).SetSerializedValue(value); orphanedEntries.Remove(key); LogManager.LogInfo("migration " + oldSection + "." + oldKey + "(" + value + ") => " + newSection + "." + newKey); } } public static void Save(bool clearOrphanedEntries = false) { if (clearOrphanedEntries) { GetOrphanedEntries().Clear(); } Config.Save(); LogManager.LogInfo("save config."); } } public static class LogManager { public static ManualLogSource Logger { private get; set; } public static void LogInfo(object data) { Logger.LogInfo(data); } public static void LogInfo(MethodBase method) { Logger.LogInfo((object)(method.DeclaringType.Name + "." + method.Name)); } public static void LogError(object data) { Logger.LogError(data); } public static void LogError(MethodBase method, object data) { Logger.LogError((object)(method.DeclaringType.Name + "." + method.Name + ": " + data)); } } public class PluginConfig { public static ConfigEntry<int> NailAttackSetter { get; private set; } public static ConfigEntry<double> NailAttackMultiplier { get; private set; } public PluginConfig(ConfigFile config) { ConfigEntry<string> obj = config.Bind<string>("Base", "ModVersion", "1.0.0", "Don't change."); bool flag = obj.Value != "1.0.0"; obj.Value = "1.0.0"; NailAttackSetter = config.Bind<int>("Settings", "NailAttackSetter", 1, "Nail attack power. If 0, it is not affected."); NailAttackMultiplier = config.Bind<double>("Settings", "NailAttackMultiplier", 1.0, "Multiplier for nail attack power. If 0, it is not affected."); if (flag) { config.Save(); LogManager.LogInfo("Config file updated and saved."); } } } [BepInPlugin("nord.Nail1ATK", "Nail1ATK", "1.0.0")] public class Plugin : BaseUnityPlugin { public const string ModGuid = "nord.Nail1ATK"; public const string ModName = "Nail1ATK"; public const string ModVersion = "1.0.0"; public static PluginConfig settings; private Harmony harmony; public void Awake() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown LogManager.Logger = ((BaseUnityPlugin)this).Logger; settings = new PluginConfig(((BaseUnityPlugin)this).Config); LogManager.LogInfo("Patching..."); harmony = new Harmony("nord.Nail1ATK.Patch"); harmony.PatchAll(typeof(PluginPatches)); LogManager.LogInfo($"Nail1ATK Patched. Settings: NailAttackSetter={PluginConfig.NailAttackSetter.Value}, NailAttackMultiplier={PluginConfig.NailAttackMultiplier.Value}"); } public void OnDestroy() { harmony.UnpatchSelf(); } } public class PluginPatches { [HarmonyPatch(/*Could not decode attribute arguments.*/)] public static void Postfix(ref int __result) { int value = PluginConfig.NailAttackSetter.Value; double value2 = PluginConfig.NailAttackMultiplier.Value; if (value != 0) { __result = value; } if (value2 != 0.0) { __result = (int)Math.Round((double)__result * value2); } } }