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 AdrenalineJunkie v1.0.2
plugins/AdrenalineJunkie.dll
Decompiled a month agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; 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.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("AdrenalineJunkie")] [assembly: AssemblyConfiguration("release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AdrenalineJunkie")] [assembly: AssemblyTitle("AdrenalineJunkie")] [assembly: AssemblyVersion("1.0.0.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 AdrenalineJunkie { [BepInPlugin("com.enki.adrenalineJunkie", "AdrenalineJunkie", "1.0.2")] public class AdrenalineJunkiePlugin : BaseUnityPlugin { private sealed class OriginalCurves { internal readonly AnimationCurve Decay; internal readonly AnimationCurve Delay; internal readonly AnimationCurve Gain; internal OriginalCurves(Player player) { Decay = CloneCurve(player.m_adrenalineDegen); Delay = CloneCurve(player.m_adrenalineDegenDelay); Gain = CloneCurve(player.m_adrenalineGainMultiplier); } } internal static ManualLogSource Log; internal static ConfigEntry<float> DecayMultiplier; internal static ConfigEntry<float> DelayMultiplier; internal static ConfigEntry<bool> EnableDelayMultiplier; internal static ConfigEntry<float> GainMultiplier; private Harmony _harmony; private static readonly ConditionalWeakTable<Player, OriginalCurves> Originals = new ConditionalWeakTable<Player, OriginalCurves>(); private void Awake() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; DecayMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Adrenaline", "DecayMultiplier", 0.5f, new ConfigDescription("Multiplier for Adrenaline decay. 0 disables natural decay; 1 is vanilla.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); DelayMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Adrenaline", "DelayMultiplier", 1.5f, new ConfigDescription("Multiplier for the delay before decay begins. 1 is vanilla.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); EnableDelayMultiplier = ((BaseUnityPlugin)this).Config.Bind<bool>("Adrenaline", "EnableDelayMultiplier", false, "Enable the custom Adrenaline decay delay. When disabled, the vanilla delay is used."); GainMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Adrenaline", "GainMultiplier", 1.25f, new ConfigDescription("Multiplier for positive Adrenaline gains. 1 is vanilla.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); DecayMultiplier.SettingChanged += OnSettingChanged; DelayMultiplier.SettingChanged += OnSettingChanged; EnableDelayMultiplier.SettingChanged += OnSettingChanged; GainMultiplier.SettingChanged += OnSettingChanged; _harmony = new Harmony("com.enki.adrenalinejunkie"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"AdrenalineJunkie 1.0.2 loaded."); } private void OnSettingChanged(object sender, EventArgs args) { ApplyToLocalPlayer(); } private static AnimationCurve CloneCurve(AnimationCurve source) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown if (source == null) { return null; } return new AnimationCurve(source.keys) { preWrapMode = source.preWrapMode, postWrapMode = source.postWrapMode }; } private static AnimationCurve ScaleCurve(AnimationCurve original, float multiplier) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (original == null) { return null; } AnimationCurve val = CloneCurve(original); Keyframe[] keys = val.keys; for (int i = 0; i < keys.Length; i++) { Keyframe val2 = keys[i]; ((Keyframe)(ref val2)).value = ((Keyframe)(ref val2)).value * multiplier; if (!float.IsInfinity(((Keyframe)(ref val2)).inTangent)) { ((Keyframe)(ref val2)).inTangent = ((Keyframe)(ref val2)).inTangent * multiplier; } if (!float.IsInfinity(((Keyframe)(ref val2)).outTangent)) { ((Keyframe)(ref val2)).outTangent = ((Keyframe)(ref val2)).outTangent * multiplier; } keys[i] = val2; } val.keys = keys; return val; } internal static void ApplyToLocalPlayer() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } try { OriginalCurves value = Originals.GetValue(localPlayer, (Player p) => new OriginalCurves(p)); localPlayer.m_adrenalineDegen = ScaleCurve(value.Decay, DecayMultiplier.Value); localPlayer.m_adrenalineDegenDelay = ScaleCurve(value.Delay, EnableDelayMultiplier.Value ? DelayMultiplier.Value : 1f); localPlayer.m_adrenalineGainMultiplier = ScaleCurve(value.Gain, GainMultiplier.Value); LogCurve("Decay", localPlayer.m_adrenalineDegen); LogCurve("Delay", localPlayer.m_adrenalineDegenDelay); LogCurve("Gain", localPlayer.m_adrenalineGainMultiplier); Log.LogInfo((object)("AdrenalineJunkie applied: Decay=" + DecayMultiplier.Value + "x, Delay=" + (EnableDelayMultiplier.Value ? (DelayMultiplier.Value + "x") : "Vanilla (disabled)") + ", Gain=" + GainMultiplier.Value + "x")); } catch (Exception ex) { Log.LogError((object)("Failed to apply AdrenalineJunkie: " + ex)); } } private static void LogCurve(string name, AnimationCurve curve) { if (curve == null || curve.length == 0) { Log.LogWarning((object)(name + " curve is null or empty.")); return; } Log.LogInfo((object)(name + " curve: " + curve.length + " keys, at 0%=" + curve.Evaluate(0f) + ", at 50%=" + curve.Evaluate(0.5f) + ", at 100%=" + curve.Evaluate(1f))); } private void OnDestroy() { if (DecayMultiplier != null) { DecayMultiplier.SettingChanged -= OnSettingChanged; } if (DelayMultiplier != null) { DelayMultiplier.SettingChanged -= OnSettingChanged; } if (GainMultiplier != null) { GainMultiplier.SettingChanged -= OnSettingChanged; } if (EnableDelayMultiplier != null) { EnableDelayMultiplier.SettingChanged -= OnSettingChanged; } if (_harmony != null) { _harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(Player), "SetLocalPlayer")] internal static class LocalPlayerPatch { private static void Postfix() { AdrenalineJunkiePlugin.ApplyToLocalPlayer(); } } }