The BepInEx console will not appear when launching like it does for other games on Thunderstore. This is normal (and helps prevent crashes during startup). You can turn it back on in your BepInEx.cfg file.
Decompiled source of PEAKLib Stats v1.2.0
plugins/com.github.PEAKModding.PEAKLib.Stats.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using On.CharacterAfflictions; using On.GUIManager; using On.StaminaBar; using PEAKLib.Core; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PEAKModding, chaendizzle")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Stats module of the PEAKLib community API for the game PEAK.")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+1f32c41faca61c1419e8fa8bfa9510d877d20085")] [assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.Stats")] [assembly: AssemblyTitle("PEAKLib.Stats")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 On.GUIManager { internal static class AddStatusFX { public delegate void PrefixSignature(GUIManager self, ref STATUSTYPE type, ref float amount); public delegate ReturnFlow ControlFlowPrefixSignature(GUIManager self, ref STATUSTYPE type, ref float amount); public delegate void PostfixSignature(GUIManager self, ref STATUSTYPE type, ref float amount); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ControlFlowPrefix(ControlFlowPrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(GUIManager); MethodInfo method = typeFromHandle.GetMethod("AddStatusFX", (BindingFlags)(-1), null, new Type[2] { typeof(STATUSTYPE), typeof(float) }, null); if ((object)method == null) { throw new MissingMethodException("GUIManager", "AddStatusFX"); } return method; } } } namespace On.StaminaBar { internal static class Update { public delegate void PrefixSignature(StaminaBar self); public delegate void PostfixSignature(StaminaBar self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(StaminaBar); MethodInfo method = typeFromHandle.GetMethod("Update", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("StaminaBar", "Update"); } return method; } } internal static class Start { public delegate void PrefixSignature(StaminaBar self); public delegate void PostfixSignature(StaminaBar self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(StaminaBar); MethodInfo method = typeFromHandle.GetMethod("Start", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("StaminaBar", "Start"); } return method; } } internal static class ChangeBar { } internal static class OutOfStaminaPulse { } internal static class DisableExtraBar { } internal static class AddRainbow { } internal static class RemoveRainbow { } internal static class PlayMoraleBoost { } internal static class MoraleBoostRoutine { } internal static class _ctor { } internal static class __RemoveRainbow_g__RemoveRainbowRoutine_36_0_d { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } internal static class _MoraleBoostRoutine_d__39 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } } namespace On.CharacterAfflictions { internal static class InitStatusArrays { public delegate void PrefixSignature(CharacterAfflictions self); public delegate void PostfixSignature(CharacterAfflictions self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("InitStatusArrays", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "InitStatusArrays"); } return method; } } internal static class UpdateNormalStatuses { public delegate void PrefixSignature(CharacterAfflictions self); public delegate void PostfixSignature(CharacterAfflictions self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("UpdateNormalStatuses", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "UpdateNormalStatuses"); } return method; } } internal static class StatusSFX { public delegate void PrefixSignature(CharacterAfflictions self, ref STATUSTYPE sT, ref float ammount); public delegate void PostfixSignature(CharacterAfflictions self, ref STATUSTYPE sT, ref float ammount); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("StatusSFX", (BindingFlags)(-1), null, new Type[2] { typeof(STATUSTYPE), typeof(float) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "StatusSFX"); } return method; } } internal static class PlayParticle { public delegate void PrefixSignature(CharacterAfflictions self, ref STATUSTYPE statusType); public delegate void PostfixSignature(CharacterAfflictions self, ref STATUSTYPE statusType); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("PlayParticle", (BindingFlags)(-1), null, new Type[1] { typeof(STATUSTYPE) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "PlayParticle"); } return method; } } internal static class GetStatusCap { public delegate void PrefixSignature(CharacterAfflictions self, ref STATUSTYPE type); public delegate void PostfixSignature(CharacterAfflictions self, ref STATUSTYPE type, ref float returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("GetStatusCap", (BindingFlags)(-1), null, new Type[1] { typeof(STATUSTYPE) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "GetStatusCap"); } return method; } } internal static class ClearAllStatus { public delegate void PrefixSignature(CharacterAfflictions self, ref bool excludeCurse); public delegate void PostfixSignature(CharacterAfflictions self, ref bool excludeCurse); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("ClearAllStatus", (BindingFlags)(-1), null, new Type[1] { typeof(bool) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "ClearAllStatus"); } return method; } } internal static class Update { public delegate void PrefixSignature(CharacterAfflictions self); public delegate void PostfixSignature(CharacterAfflictions self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("Update", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "Update"); } return method; } } internal static class GetCurrentStatus { public delegate void PrefixSignature(CharacterAfflictions self, ref STATUSTYPE statusType); public delegate void PostfixSignature(CharacterAfflictions self, ref STATUSTYPE statusType, ref float returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("GetCurrentStatus", (BindingFlags)(-1), null, new Type[1] { typeof(STATUSTYPE) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "GetCurrentStatus"); } return method; } } internal static class LastAddedStatus { public delegate void PrefixSignature(CharacterAfflictions self, ref STATUSTYPE statusType); public delegate void PostfixSignature(CharacterAfflictions self, ref STATUSTYPE statusType, ref float returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("LastAddedStatus", (BindingFlags)(-1), null, new Type[1] { typeof(STATUSTYPE) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "LastAddedStatus"); } return method; } } internal static class SubtractStatus { public delegate void PrefixSignature(CharacterAfflictions self, ref STATUSTYPE statusType, ref float amount, ref bool fromRPC); public delegate void PostfixSignature(CharacterAfflictions self, ref STATUSTYPE statusType, ref float amount, ref bool fromRPC); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("SubtractStatus", (BindingFlags)(-1), null, new Type[3] { typeof(STATUSTYPE), typeof(float), typeof(bool) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "SubtractStatus"); } return method; } } internal static class SetStatus { public delegate void PrefixSignature(CharacterAfflictions self, ref STATUSTYPE statusType, ref float amount); public delegate void PostfixSignature(CharacterAfflictions self, ref STATUSTYPE statusType, ref float amount); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(CharacterAfflictions); MethodInfo method = typeFromHandle.GetMethod("SetStatus", (BindingFlags)(-1), null, new Type[2] { typeof(STATUSTYPE), typeof(float) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterAfflictions", "SetStatus"); } return method; } } internal static class Awake { } internal static class OnPlayerEnteredRoom { } internal static class UpdateWeight { } internal static class AddAffliction { } internal static class RemoveAffliction { } internal static class GetIncrementalStatus { } internal static class LastAddedIncrementalStatus { } internal static class get_statusSum { } internal static class AdjustStatus { } internal static class AddStatus { } internal static class PlayDebugParticle { } internal static class PushStatuses { } internal static class SyncStatusesRPC { } internal static class ApplyStatusesFromFloatArrayRPC { } internal static class PushAfflictions { } internal static class SyncAfflictionsRPC { } internal static class HasAfflictionType { } internal static class Starve { } internal static class AddPoisonOverTime { } internal static class ClearAllAilments { } internal static class ClearHunger { } internal static class ClearDrowsy { } internal static class ClearInjury { } internal static class ClearCurse { } internal static class ClearCold { } internal static class ClearPoison { } internal static class ClearHot { } internal static class ClearAll { } internal static class ClearPoisonAfflictions { } internal static class AddDrowsy { } internal static class AddCurse { } internal static class Die { } internal static class AddPoison { } internal static class AddCold { } internal static class AddHot { } internal static class AddInjury { } internal static class AddHunger { } internal static class TestCrab { } internal static class _ctor { } internal static class STATUSTYPE { internal static class _ctor { } } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } public bool DistinguishOverloadsByName { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PEAKLib.Stats { public static class CustomStatusManager { private static SortedList<string, Status> registered = new SortedList<string, Status>(); public static IList<Status> Statuses => registered.Values; public static int Length => registered.Count; internal static void RegisterStatus(Status status, ModDefinition owner) { string text = owner.Id + "->" + status.Name; if (registered.ContainsKey(text)) { throw new ArgumentException("Status effect with name " + text + " already registered. Choose a unique name."); } registered.Add(text, status); ReIndex(); } internal static Status StatusByType(STATUSTYPE type) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return registered.FirstOrDefault<KeyValuePair<string, Status>>((KeyValuePair<string, Status> x) => x.Value.Type == type).Value; } private static void ReIndex() { List<STATUSTYPE> list = Enum.GetValues(typeof(STATUSTYPE)).OfType<STATUSTYPE>().ToList(); List<Status> list2 = registered.Values.ToList(); int i = 0; int num = 0; for (; i < list.Count + list2.Count; i++) { if (num >= list2.Count) { break; } if (!Enum.IsDefined(typeof(STATUSTYPE), i)) { list2[num].Index = i; num++; } } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.PEAKModding.PEAKLib.Stats", "PEAKLib.Stats", "1.2.0")] public class StatsPlugin : BaseUnityPlugin { public const string Id = "com.github.PEAKModding.PEAKLib.Stats"; internal static ManualLogSource Log { get; } = Logger.CreateLogSource(Name); public static string Name => "PEAKLib.Stats"; public static string Version => "1.2.0"; private void Awake() { MonoDetourManager.InvokeHookInitializers(typeof(StatsPlugin).Assembly); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } } public class Status { public delegate void UpdateStatusHandler(CharacterAfflictions chaf, Status status); internal int Index; public string Name { get; set; } = ""; public Color Color { get; set; } = Color.white; public float MaxAmount { get; set; } = 2f; public float ReductionCooldown { get; set; } public float ReductionPerSecond { get; set; } public bool AllowClear { get; set; } = true; public UpdateStatusHandler? Update { get; set; } public Sprite? Icon { get; set; } public SFX_Instance? SFX { get; set; } public STATUSTYPE Type => (STATUSTYPE)Index; } public class StatusContent : IContent<StatusContent>, IContent { [CompilerGenerated] private Status <status>P; internal static List<RegisteredContent<StatusContent>> s_RegisteredStatuses = new List<RegisteredContent<StatusContent>>(); public string Name => Status.Name; public Status Status { get; } public StatusContent(Status status) { <status>P = status; Status = ThrowHelper.ThrowIfArgumentNull<Status>(<status>P, "status"); base..ctor(); } public RegisteredContent<StatusContent> Register(ModDefinition owner) { RegisteredContent<StatusContent> val = ContentRegistry.Register<StatusContent>(this, owner); s_RegisteredStatuses.Add(val); CustomStatusManager.RegisterStatus(<status>P, owner); return val; } IRegisteredContent IContent.Register(ModDefinition owner) { return (IRegisteredContent)(object)Register(owner); } public IContent Resolve() { return (IContent)(object)this; } } } namespace PEAKLib.Stats.Hooks { [MonoDetourTargets(typeof(CharacterAfflictions))] internal static class CharacterAfflictionsHooks { [MonoDetourHookInitialize] private static void Init() { InitStatusArrays.Postfix(Postfix_InitStatusArrays); UpdateNormalStatuses.Postfix(Postfix_UpdateNormalStatuses); StatusSFX.Postfix(Postfix_StatusSFX); PlayParticle.Postfix(Postfix_PlayParticle); GetStatusCap.Postfix(Postfix_GetStatusCap); ClearAllStatus.Postfix(Postfix_ClearAllStatus); } private static void Postfix_InitStatusArrays(CharacterAfflictions self) { self.currentStatuses = new float[Enum.GetNames(typeof(STATUSTYPE)).Length + CustomStatusManager.Length]; self.currentIncrementalStatuses = new float[self.currentStatuses.Length]; self.currentDecrementalStatuses = new float[self.currentStatuses.Length]; self.lastAddedStatus = new float[self.currentStatuses.Length]; self.lastAddedIncrementalStatus = new float[self.currentStatuses.Length]; } private static void Postfix_UpdateNormalStatuses(CharacterAfflictions self) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) if (!self.character.IsLocal) { return; } foreach (Status status in CustomStatusManager.Statuses) { if (status.Update != null) { status.Update(self, status); } else if (self.GetCurrentStatus(status.Type) > 0f && Time.time - self.LastAddedStatus(status.Type) > status.ReductionCooldown) { self.SubtractStatus(status.Type, status.ReductionPerSecond * Time.deltaTime, false); } } } private static void Postfix_StatusSFX(CharacterAfflictions self, ref STATUSTYPE status, ref float amount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) Status status2 = CustomStatusManager.StatusByType(status); if ((Object)(object)status2?.SFX != (Object)null) { status2.SFX.Play(default(Vector3)); } } private static void Postfix_PlayParticle(CharacterAfflictions self, ref STATUSTYPE status) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) Status status2 = CustomStatusManager.StatusByType(status); if (status2 != null) { self.character.refs.customization.PulseStatus(status2.Color); } } private static void Postfix_GetStatusCap(CharacterAfflictions self, ref STATUSTYPE status, ref float returnValue) { returnValue = CustomStatusManager.StatusByType(status)?.MaxAmount ?? returnValue; } private static void Postfix_ClearAllStatus(CharacterAfflictions self, ref bool excludeCurse) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) foreach (Status status in CustomStatusManager.Statuses) { ManualLogSource log = StatsPlugin.Log; STATUSTYPE type = status.Type; log.LogInfo((object)("Clearing status: " + ((object)(STATUSTYPE)(ref type)).ToString())); if (status.AllowClear) { StatsPlugin.Log.LogInfo((object)$"Current: {status.Type}, amount {self.character.refs.afflictions.GetCurrentStatus(status.Type)}"); StatsPlugin.Log.LogInfo((object)$"SetStatus status: {status.Type}"); self.character.refs.afflictions.SetStatus(status.Type, 0f); } } } } [MonoDetourTargets(typeof(GUIManager), GenerateControlFlowVariants = true, Members = new string[] { "AddStatusFX" })] internal static class GUIManagerHooks { [MonoDetourHookInitialize] private static void Init() { AddStatusFX.ControlFlowPrefix(Prefix_AddStatusFX); } private static ReturnFlow Prefix_AddStatusFX(GUIManager self, ref STATUSTYPE type, ref float amount) { if (CustomStatusManager.StatusByType(type) == null) { return (ReturnFlow)0; } return (ReturnFlow)1; } } [MonoDetourTargets(typeof(StaminaBar))] internal static class StaminaBarHooks { [MonoDetourHookInitialize] private static void Init() { Start.Prefix(Prefix_Start); } private unsafe static void Prefix_Start(StaminaBar self) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0080->IL0080: Incompatible stack types: O vs I4 //IL_0079->IL0080: Incompatible stack types: I4 vs O //IL_0079->IL0080: Incompatible stack types: O vs I4 BarAffliction[] componentsInChildren = ((Component)self).GetComponentsInChildren<BarAffliction>(true); GameObject gameObject = ((Component)componentsInChildren[^1]).gameObject; int num = Enum.GetValues(typeof(STATUSTYPE)).Length + CustomStatusManager.Length; if (componentsInChildren.Length >= num) { return; } for (int i = componentsInChildren.Length; i < num; i++) { Status status = CustomStatusManager.StatusByType((STATUSTYPE)i); BarAffliction component = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent).GetComponent<BarAffliction>(); component.rtf = ((Component)component).GetComponent<RectTransform>(); object obj = component; int num2; if (status == null) { num2 = 0; obj = num2; num2 = (int)obj; } else { obj = status.Type; num2 = (int)obj; } Unsafe.Write(&((BarAffliction)num2).afflictionType, (STATUSTYPE)obj); component.size = 0f; component.icon = ((Component)((Component)component).transform.Find("Icon")).GetComponent<Image>(); component.icon.sprite = status?.Icon; ((Graphic)component.icon).color = status?.Color ?? Color.white; ((Graphic)((Component)((Component)component).transform.Find("Fill")).GetComponent<Image>()).color = status?.Color ?? Color.white; ((Graphic)((Component)((Component)component).transform.Find("Outline")).GetComponent<Image>()).color = status?.Color ?? Color.white; ((Object)((Component)component).gameObject).name = status?.Name; } } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }