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 ZeroSkillDrain v1.1.1
ZeroSkillDrain.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("ZeroSkillDrain")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+12975d863bd38cef1600bff4ca1a2a9b0718a3cd")] [assembly: AssemblyProduct("ZeroSkillDrain")] [assembly: AssemblyTitle("ZeroSkillDrain")] [assembly: AssemblyVersion("1.1.1.0")] [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 ZeroSkillDrain { [BepInPlugin("thereborngeek.zeroskilldrain", "Zero Skill Drain", "1.1.1")] public class ZeroSkillDrainPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(ZoneSystem), "SetStartingGlobalKeys")] private static class SetStartingGlobalKeysPatch { private static void Postfix(ZoneSystem __instance) { float num = default(float); if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.instance.IsServer() && (!__instance.GetGlobalKey((GlobalKeys)13, ref num) || num != 0f)) { s_globalKeyAdd(__instance, "skillreductionrate 0", arg3: true); s_sendGlobalKeys(__instance, 0L); s_log.LogInfo((object)"Skill drain on death disabled (skillreductionrate 0)"); } } } [HarmonyPatch(typeof(Skills), "OnDeath")] private static class SkillsOnDeathPatch { private static bool Prefix() { return Game.m_skillReductionRate != 0f; } } public const string Guid = "thereborngeek.zeroskilldrain"; public const string Name = "Zero Skill Drain"; public const string Version = "1.1.1"; private const string Key = "skillreductionrate 0"; private static readonly Action<ZoneSystem, string, bool> s_globalKeyAdd = AccessTools.MethodDelegate<Action<ZoneSystem, string, bool>>(AccessTools.Method(typeof(ZoneSystem), "GlobalKeyAdd", (Type[])null, (Type[])null), (object)null, true); private static readonly Action<ZoneSystem, long> s_sendGlobalKeys = AccessTools.MethodDelegate<Action<ZoneSystem, long>>(AccessTools.Method(typeof(ZoneSystem), "SendGlobalKeys", (Type[])null, (Type[])null), (object)null, true); private static ManualLogSource s_log; private void Awake() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) s_log = ((BaseUnityPlugin)this).Logger; new Harmony("thereborngeek.zeroskilldrain").PatchAll(typeof(ZeroSkillDrainPlugin).Assembly); } } }