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 AbilitiesUnlocked v1.0.0
AbilitiesUnlocked.dll
Decompiled 8 months agousing System; 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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SkyLevelCooldown")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SkyLevelCooldown")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("74eb5aae-2b80-4e14-b616-24649964c125")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("com.sky.silksong.unlockabilities", "Silksong Unlock Abilities", "1.0.0")] [BepInProcess("Hollow Knight Silksong.exe")] public class UnlockAbilitiesPlugin : BaseUnityPlugin { public const string PluginGUID = "com.sky.silksong.unlockabilities"; public const string PluginName = "Silksong Unlock Abilities"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; private Harmony _harmony; internal static ConfigEntry<bool> UnlockDash; internal static ConfigEntry<bool> UnlockWalljump; internal static ConfigEntry<bool> UnlockDoubleJump; internal static ConfigEntry<bool> UnlockSuperJump; internal static ConfigEntry<bool> UnlockGlide; internal static ConfigEntry<bool> UnlockNeedolin; internal static ConfigEntry<bool> UnlockHarpoonDash; internal static ConfigEntry<bool> UnlockChargeSlash; private void Awake() { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; UnlockDash = ((BaseUnityPlugin)this).Config.Bind<bool>("Abilities", "UnlockDash", true, "Unlock Dash at game start"); UnlockWalljump = ((BaseUnityPlugin)this).Config.Bind<bool>("Abilities", "UnlockWalljump", true, "Unlock Walljump at game start"); UnlockDoubleJump = ((BaseUnityPlugin)this).Config.Bind<bool>("Abilities", "UnlockDoubleJump", true, "Unlock DoubleJump at game start"); UnlockSuperJump = ((BaseUnityPlugin)this).Config.Bind<bool>("Abilities", "UnlockSuperJump", true, "Unlock SuperJump at game start"); UnlockGlide = ((BaseUnityPlugin)this).Config.Bind<bool>("Abilities", "UnlockGlide", true, "Unlock Glide (Brolly) at game start"); UnlockNeedolin = ((BaseUnityPlugin)this).Config.Bind<bool>("Abilities", "UnlockNeedolin", true, "Unlock Needolin (music) at game start"); UnlockHarpoonDash = ((BaseUnityPlugin)this).Config.Bind<bool>("Abilities", "UnlockHarpoonDash", true, "Unlock Harpoon/Grapple Dash at game start"); UnlockChargeSlash = ((BaseUnityPlugin)this).Config.Bind<bool>("Abilities", "UnlockChargeSlash", true, "Unlock Charge Slash attack at game start"); _harmony = new Harmony("com.sky.silksong.unlockabilities"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); Log.LogInfo((object)"Silksong Unlock Abilities v1.0.0 loaded and patches applied."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch] internal static class HeroController_Awake_Patch { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("HeroController"); if (type == null) { throw new Exception("Could not find type HeroController"); } return AccessTools.Method(type, "Start", (Type[])null, (Type[])null); } private static void Postfix(object __instance) { try { Type type = __instance.GetType(); object pd = AccessTools.Field(type, "playerData")?.GetValue(__instance); if (pd == null) { UnlockAbilitiesPlugin.Log.LogWarning((object)"[UnlockAbilities] PlayerData was null, skipping unlock."); return; } if (UnlockAbilitiesPlugin.UnlockDash.Value) { SetBool("hasDash"); } if (UnlockAbilitiesPlugin.UnlockWalljump.Value) { SetBool("hasWalljump"); } if (UnlockAbilitiesPlugin.UnlockDoubleJump.Value) { SetBool("hasDoubleJump"); } if (UnlockAbilitiesPlugin.UnlockSuperJump.Value) { SetBool("hasSuperJump"); } if (UnlockAbilitiesPlugin.UnlockGlide.Value) { SetBool("hasBrolly"); } if (UnlockAbilitiesPlugin.UnlockNeedolin.Value) { SetBool("hasNeedolin"); } if (UnlockAbilitiesPlugin.UnlockHarpoonDash.Value) { SetBool("hasHarpoonDash"); } if (UnlockAbilitiesPlugin.UnlockChargeSlash.Value) { SetBool("hasChargeSlash"); } UnlockAbilitiesPlugin.Log.LogInfo((object)"[UnlockAbilities] Config-based abilities unlocked at game start."); void SetBool(string fieldName) { FieldInfo fieldInfo = AccessTools.Field(pd.GetType(), fieldName); if (fieldInfo != null) { fieldInfo.SetValue(pd, true); UnlockAbilitiesPlugin.Log.LogDebug((object)("Unlocked ability: " + fieldName)); } } } catch (Exception arg) { UnlockAbilitiesPlugin.Log.LogError((object)$"[UnlockAbilities] Failed to unlock abilities: {arg}"); } } }