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 SkyheimCompat v1.0.0
Skyheim-Compat.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using skyheim; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyCompany("Cjayride.SkyheimCompat")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Cjayride.SkyheimCompat")] [assembly: AssemblyTitle("Cjayride.SkyheimCompat")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Cjayride.SkyheimCompat { [BepInPlugin("cjayride.skyheimcompat", "Cjayride Skyheim Compat", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGUID = "cjayride.skyheimcompat"; public const string PluginName = "Cjayride Skyheim Compat"; public const string PluginVersion = "1.0.0"; private Harmony _harmony; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown _harmony = new Harmony("cjayride.skyheimcompat"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Cjayride Skyheim Compat 1.0.0 loaded — enforcing Skyheim rune cooldowns."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal static bool IsBlockedByCooldown(Humanoid character, ItemData weapon) { if ((Object)(object)character == (Object)null || (Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)character != (Object)(object)Player.m_localPlayer) { return false; } if (SkyheimCooldown.Instance == null) { return false; } SkyheimItemData runeData = GetRuneData(weapon); if ((Object)(object)runeData == (Object)null || runeData.Cooldown <= 0f) { return false; } return SkyheimCooldown.Instance.GetCooldown(((Object)((Component)runeData).gameObject).name) > 0f; } private static SkyheimItemData GetRuneData(ItemData item) { if (item == null) { return null; } GameObject val = item.m_dropPrefab; if ((Object)(object)val == (Object)null && (Object)(object)ObjectDB.instance != (Object)null && item.m_shared != null) { val = ObjectDB.instance.GetItemPrefab(item.m_shared.m_name); } if (!((Object)(object)val != (Object)null)) { return null; } return val.GetComponent<SkyheimItemData>(); } } [HarmonyPatch(typeof(Humanoid), "StartAttack")] [HarmonyPriority(800)] internal static class Humanoid_StartAttack_Patch { private static bool Prefix(Humanoid __instance, ref bool __result) { if (!Plugin.IsBlockedByCooldown(__instance, __instance.GetCurrentWeapon())) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(Attack), "Start")] [HarmonyPriority(800)] internal static class Attack_Start_Patch { private static bool Prefix(Humanoid character, ItemData weapon, ref bool __result) { if (!Plugin.IsBlockedByCooldown(character, weapon)) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(Attack), "StartWithoutAnimation")] [HarmonyPriority(800)] internal static class Attack_StartWithoutAnimation_Patch { private static bool Prefix(Humanoid character, ItemData weapon) { return !Plugin.IsBlockedByCooldown(character, weapon); } } [HarmonyPatch(typeof(Attack), "HaveAmmo")] [HarmonyPriority(0)] internal static class Attack_HaveAmmo_Patch { private static void Postfix(Humanoid character, ItemData weapon, ref bool __result) { if (__result && Plugin.IsBlockedByCooldown(character, weapon)) { __result = false; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }