The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of PEAKLib Items v1.5.3
plugins/com.github.PEAKModding.PEAKLib.Items.dll
Decompiled 3 weeks agousing System; using System.Collections; 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.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoDetour; using MonoDetour.Cil; using MonoDetour.Cil.Analysis; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using MonoDetour.Reflection.Unspeakable; using MonoMod.Cil; using MonoMod.Utils; using Newtonsoft.Json; using On.CharacterAnimations; using On.CharacterItems; using On.DataEntryValue; using On.GUIManager; using On.Interaction; using On.Item; using On.ItemDatabase; using PEAKLib.Core; using Photon.Pun; using TMPro; using UnityEngine; using Zorro.Core; using Zorro.Core.Serizalization; [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, Hamunii, quackandcheese, chaendizzle")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Items module of the PEAKLib community API for the game PEAK.")] [assembly: AssemblyFileVersion("1.5.3.0")] [assembly: AssemblyInformationalVersion("1.5.3+34232518a1ce45d73c8bf4e3afea3e0dece25599")] [assembly: AssemblyProduct("com.github.PEAKModding.PEAKLib.Items")] [assembly: AssemblyTitle("PEAKLib.Items")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.3.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.Item { internal static class CanUseSecondary { public delegate void PrefixSignature(Item self); public delegate void PostfixSignature(Item self, ref bool 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(Item); MethodInfo method = typeFromHandle.GetMethod("CanUseSecondary", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("Item", "CanUseSecondary"); } return method; } } internal static class StartUseSecondary { public delegate void PrefixSignature(Item self); public delegate void PostfixSignature(Item 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(Item); MethodInfo method = typeFromHandle.GetMethod("StartUseSecondary", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("Item", "StartUseSecondary"); } return method; } } internal static class FinishCastSecondary { public delegate void PrefixSignature(Item self); public delegate void PostfixSignature(Item 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(Item); MethodInfo method = typeFromHandle.GetMethod("FinishCastSecondary", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("Item", "FinishCastSecondary"); } return method; } } internal static class RemoveFeedDataRPC { public delegate void PrefixSignature(Item self, ref int giverID); public delegate void PostfixSignature(Item self, ref int giverID); 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(Item); MethodInfo method = typeFromHandle.GetMethod("RemoveFeedDataRPC", (BindingFlags)(-1), null, new Type[1] { typeof(int) }, null); if ((object)method == null) { throw new MissingMethodException("Item", "RemoveFeedDataRPC"); } return method; } } internal static class ConsumeDelayed { public delegate void PrefixSignature(Item self, ref bool ignoreActions); public delegate void PostfixSignature(Item self, ref bool ignoreActions, ref IEnumerator returnValue); public delegate void PrefixMoveNextSignature(SpeakableEnumerator<object, Item> self); public delegate void PostfixMoveNextSignature(SpeakableEnumerator<object, Item> self, ref bool continueEnumeration); 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 MonoDetourHook PrefixMoveNext(PrefixMoveNextSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PrefixDetour>((MethodBase)StateMachineTarget(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook PostfixMoveNext(PostfixMoveNextSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>((MethodBase)StateMachineTarget(), (MethodBase)hook.Method, config, applyByDefault); } public static MonoDetourHook ILHookMoveNext(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook((MethodBase)StateMachineTarget(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(Item); MethodInfo method = typeFromHandle.GetMethod("ConsumeDelayed", (BindingFlags)(-1), null, new Type[1] { typeof(bool) }, null); if ((object)method == null) { throw new MissingMethodException("Item", "ConsumeDelayed"); } return method; } public static MethodInfo StateMachineTarget() { return Extensions.GetStateMachineTarget((MethodInfo)Target()); } } internal static class GetName { public delegate void PrefixSignature(Item self); public delegate void PostfixSignature(Item self, ref string 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(Item); MethodInfo method = typeFromHandle.GetMethod("GetName", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("Item", "GetName"); } return method; } } internal static class get_itemState { } internal static class set_itemState { } internal static class get_CarryWeight { } internal static class get_isUsingPrimary { } internal static class set_isUsingPrimary { } internal static class get_cooking { } internal static class set_cooking { } internal static class Awake { } internal static class Start { } internal static class GetItemName { } internal static class AddPropertyBlock { } internal static class GetItemActions { } internal static class AddPhysics { } internal static class Update { } internal static class UpdateCollisionDetectionMode { } internal static class Interact { } internal static class DenyPickupRPC { } internal static class RequestPickup { } internal static class ClearDataFromBackpack { } internal static class Center { } internal static class GetTransform { } internal static class GetInteractionText { } internal static class IsInteractible { } internal static class Move { } internal static class get_holderCharacter { } internal static class set_holderCharacter { } internal static class get_trueHolderCharacter { } internal static class SetColliders { } internal static class SetState { } internal static class HideRenderers { } internal static class get_isUsingSecondary { } internal static class set_isUsingSecondary { } internal static class get_castProgress { } internal static class set_castProgress { } internal static class get_progress { } internal static class get_shouldShowCastProgress { } internal static class CanUsePrimary { } internal static class StartUsePrimary { } internal static class ContinueUsePrimary { } internal static class FinishCastPrimary { } internal static class CancelUsePrimary { } internal static class ScrollButtonLeft { } internal static class ScrollButtonRight { } internal static class Scroll { } internal static class SendFeedDataRPC { } internal static class get_totalSecondaryUsingTime { } internal static class ContinueUseSecondary { } internal static class CancelUseSecondary { } internal static class get_consuming { } internal static class set_consuming { } internal static class Consume { } internal static class OnStash { } internal static class AddDefaultFoodScripts { } internal static class HoverEnter { } internal static class HoverExit { } internal static class SetKinematicNetworked_System_Boolean { } internal static class SetKinematicNetworked_System_Boolean_UnityEngine_Vector3_UnityEngine_Quaternion { } internal static class SetKinematicAndResetSyncData { } internal static class SetKinematicRPC { } internal static class HasData { } internal static class ForceSyncForFrames { } internal static class SetItemInstanceDataRPC { } internal static class OnInstanceDataRecieved { } internal static class OnPlayerEnteredRoom { } internal static class PutInBackpackRPC { } internal static class SetCookedAmountRPC { } internal static class SetUseRemainingPercentage { } internal static class get_inActiveList { } internal static class set_inActiveList { } internal static class WasActive { } internal static class UpdateEntryInActiveList { } internal static class RemoveFromActiveList { } internal static class OnDestroy { } internal static class TryGetFeeder { } internal static class IsValidToSpawn { } internal static class AddNameToCSV { } internal static class AddPromptToCSV { } internal static class RPC_SetThrownData { } internal static class _ctor { } internal static class _cctor { } internal static class ItemTags { internal static class _ctor { } } internal static class ItemUIData { internal static class GetIcon { } internal static class _ctor { } } internal static class __c { internal static class _ctor { } } internal static class _ConsumeDelayed_d__134 { 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.Interaction { internal static class LateUpdate { public delegate void PrefixSignature(Interaction self); public delegate void PostfixSignature(Interaction 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(Interaction); MethodInfo method = typeFromHandle.GetMethod("LateUpdate", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("Interaction", "LateUpdate"); } return method; } } internal static class get_currentInteractableHeldTime { } internal static class set_currentInteractableHeldTime { } internal static class get_constantInteractableProgress { } internal static class Awake { } internal static class get_canInteract { } internal static class get_hasValidTargetCharacter { } internal static class DoInteraction { } internal static class DoInteractableRaycasts { } internal static class CancelHeldInteract { } internal static class _ctor { } } namespace On.GUIManager { internal static class RefreshInteractablePrompt { public delegate void PrefixSignature(GUIManager self); public delegate void PostfixSignature(GUIManager 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(GUIManager); MethodInfo method = typeFromHandle.GetMethod("RefreshInteractablePrompt", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("GUIManager", "RefreshInteractablePrompt"); } return method; } } } namespace On.ItemDatabase { internal static class OnLoaded { public delegate void PrefixSignature(ItemDatabase self); public delegate void PostfixSignature(ItemDatabase 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(ItemDatabase); MethodInfo method = typeFromHandle.GetMethod("OnLoaded", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("ItemDatabase", "OnLoaded"); } return method; } } internal static class LoadItems { } internal static class ReloadAllItems { } internal static class GetAvailableID { } internal static class ItemExistsInDatabase { } internal static class Add_Item { } internal static class Add_Item_UnityEngine_Vector3 { } internal static class TryGetItem { } internal static class AddAllNamesToCSV { } internal static class AddAllPromptsToCSV { } internal static class _ctor { } } namespace On.CharacterItems { internal static class AttachItem { public delegate void PrefixSignature(CharacterItems self, ref Item item); public delegate void PostfixSignature(CharacterItems self, ref Item item); 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(CharacterItems); MethodInfo method = typeFromHandle.GetMethod("AttachItem", (BindingFlags)(-1), null, new Type[1] { typeof(Item) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterItems", "AttachItem"); } return method; } } internal static class GetItemPosLeft { public delegate void PrefixSignature(CharacterItems self, ref Item item); public delegate void PostfixSignature(CharacterItems self, ref Item item, ref Vector3 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(CharacterItems); MethodInfo method = typeFromHandle.GetMethod("GetItemPosLeft", (BindingFlags)(-1), null, new Type[1] { typeof(Item) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterItems", "GetItemPosLeft"); } return method; } } internal static class GetItemPosRight { public delegate void PrefixSignature(CharacterItems self, ref Item item); public delegate void PostfixSignature(CharacterItems self, ref Item item, ref Vector3 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(CharacterItems); MethodInfo method = typeFromHandle.GetMethod("GetItemPosRight", (BindingFlags)(-1), null, new Type[1] { typeof(Item) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterItems", "GetItemPosRight"); } return method; } } internal static class GetItemRotRight { public delegate void PrefixSignature(CharacterItems self, ref Item item); public delegate void PostfixSignature(CharacterItems self, ref Item item, ref Quaternion 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(CharacterItems); MethodInfo method = typeFromHandle.GetMethod("GetItemRotRight", (BindingFlags)(-1), null, new Type[1] { typeof(Item) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterItems", "GetItemRotRight"); } return method; } } internal static class GetItemRotLeft { public delegate void PrefixSignature(CharacterItems self, ref Item item); public delegate void PostfixSignature(CharacterItems self, ref Item item, ref Quaternion 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(CharacterItems); MethodInfo method = typeFromHandle.GetMethod("GetItemRotLeft", (BindingFlags)(-1), null, new Type[1] { typeof(Item) }, null); if ((object)method == null) { throw new MissingMethodException("CharacterItems", "GetItemRotLeft"); } return method; } } internal static class SubscribeRoutine { } internal static class Awake { } internal static class OnDestroy { } internal static class FixedUpdate { } internal static class HoldItem { } internal static class Update { } internal static class DoUsing { } internal static class DoDropping { } internal static class DropAllItems { } internal static class DropItemFromSlotRPC { } internal static class DestroyHeldItemRpc { } internal static class DropItemRpc { } internal static class OnPickupAccepted { } internal static class RefreshAllCharacterCarryWeight { } internal static class RefreshAllCharacterCarryWeightRPC { } internal static class EquipSlot { } internal static class EquipSlotRpc { } internal static class Equip { } internal static class UnAttachItem { } internal static class GetItemHoldRotation { } internal static class GetItemHoldUp { } internal static class GetItemHoldForward { } internal static class GetItemHoldPos { } internal static class UnAttatchEquipedItem { } internal static class get_equippedSlotCooldown { } internal static class get_lockedFromSwitching { } internal static class DoSwitching { } internal static class AddGravity { } internal static class AddMovementForce { } internal static class AddDrag { } internal static class AddParasolDrag { } internal static class GetItemPosRightWorld { } internal static class GetItemPosLeftWorld { } internal static class GetItemRotRightWorld { } internal static class GetItemRotLeftWorld { } internal static class OnPlayerEnteredRoom { } internal static class RPC_InitHoldingItem { } internal static class UpdateClimbingSpikeCount { } internal static class UpdateBalloonCount { } internal static class WithinClimbingSpikePreviewRange { } internal static class get_climbingSpikeCastProgress { } internal static class UpdateClimbingSpikeUse { } internal static class get_climbingSpikeSelected { } internal static class CancelClimbingSpike { } internal static class InstantiateClimbingSpikePreview { } internal static class RaycastClimbingSpikeStart { } internal static class HammerClimbingSpike { } internal static class SpawnItemInHand { } internal static class RPC_SpawnItemInHandMaster { } internal static class _ctor { } internal static class __c__DisplayClass30_0 { internal static class _ctor { } internal static class __EquipSlot_g__TheRest_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 __c__DisplayClass33_0 { internal static class _ctor { } internal static class __Equip_g__IWait_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 _SubscribeRoutine_d__12 { 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.CharacterAnimations { internal static class ConfigureIK { public delegate void PrefixSignature(CharacterAnimations self); public delegate void PostfixSignature(CharacterAnimations 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(CharacterAnimations); MethodInfo method = typeFromHandle.GetMethod("ConfigureIK", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("CharacterAnimations", "ConfigureIK"); } return method; } } internal static class HandleIK { public delegate void PrefixSignature(CharacterAnimations self); public delegate void PostfixSignature(CharacterAnimations 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(CharacterAnimations); MethodInfo method = typeFromHandle.GetMethod("HandleIK", (BindingFlags)(-1), null, Array.Empty<Type>(), null); if ((object)method == null) { throw new MissingMethodException("CharacterAnimations", "HandleIK"); } return method; } } internal static class Awake { } internal static class Start { } internal static class UpdateHeadBob { } internal static class Update { } internal static class SetAnimSpeed { } internal static class ReachIK { } internal static class Land { } internal static class Jump { } internal static class StartJump { } internal static class StartClimb { } internal static class PlaySpecificAnimation { } internal static class PrepIK { } internal static class PlayEmote { } internal static class RPCA_PlayRemove { } internal static class SetBool { } internal static class _ctor { } } namespace On.DataEntryValue { internal static class GetTypeValue { public delegate void PrefixSignature(ref Type type); public delegate ReturnFlow ControlFlowPrefixSignature(ref Type type, ref byte returnValue); public delegate void PostfixSignature(ref Type type, ref byte 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 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(DataEntryValue); MethodInfo method = typeFromHandle.GetMethod("GetTypeValue", (BindingFlags)(-1), null, new Type[1] { typeof(Type) }, null); if ((object)method == null) { throw new MissingMethodException("DataEntryValue", "GetTypeValue"); } return method; } } internal static class GetNewFromValue { public delegate void PrefixSignature(ref byte value); public delegate ReturnFlow ControlFlowPrefixSignature(ref byte value, ref DataEntryValue returnValue); public delegate void PostfixSignature(ref byte value, ref DataEntryValue 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 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(DataEntryValue); MethodInfo method = typeFromHandle.GetMethod("GetNewFromValue", (BindingFlags)(-1), null, new Type[1] { typeof(byte) }, null); if ((object)method == null) { throw new MissingMethodException("DataEntryValue", "GetNewFromValue"); } return method; } } internal static class Serialize { } internal static class Deserialize { } internal static class Init { } 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.Items { public static class CustomItemData { internal const DataEntryKey PeakLibModDataKey = 42; public static bool TryGetModItemDataFromJson<T>(this ItemComponent item, ModDefinition mod, [MaybeNullWhen(false)] out T data) { data = default(T); if (!item.TryGetRawModItemData(mod, out byte[] rawData)) { return false; } data = JsonConvert.DeserializeObject<T>(Encoding.UTF8.GetString(rawData)); return data != null; } public static bool TryGetRawModItemData(this ItemComponent item, ModDefinition mod, [NotNullWhen(true)] out byte[]? rawData) { ThrowHelper.ThrowIfArgumentNull<ItemComponent>(item, "item"); ThrowHelper.ThrowIfArgumentNull<ModDefinition>(mod, "mod"); ModItemData data = item.GetData<ModItemData>((DataEntryKey)42); return data.Value.TryGetValue(((object)mod).GetHashCode(), out rawData); } public static void SetModItemDataFromJson(this ItemComponent item, ModDefinition mod, object? data) { item.SetRawModItemData(mod, Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(data))); } public static void SetRawModItemData(this ItemComponent item, ModDefinition mod, byte[] rawData) { ThrowHelper.ThrowIfArgumentNull<ItemComponent>(item, "item"); ThrowHelper.ThrowIfArgumentNull<ModDefinition>(mod, "mod"); ModItemData data = item.GetData<ModItemData>((DataEntryKey)42); data.Value[((object)mod).GetHashCode()] = rawData; } } public interface IItemContent : IContent { Item Item { get; } } public class ItemContent : IContent<ItemContent>, IContent, IItemContent { [CompilerGenerated] private Item <item>P; internal static List<RegisteredContent<ItemContent>> s_RegisteredItems = new List<RegisteredContent<ItemContent>>(); public string Name => ((Object)Item).name; public Item Item { get; } public ItemContent(Item item) { <item>P = item; Item = ThrowHelper.ThrowIfArgumentNull<Item>(<item>P, "item"); base..ctor(); } public RegisteredContent<ItemContent> Register(ModDefinition owner) { RegisteredContent<ItemContent> val = ContentRegistry.Register<ItemContent>(this, owner); ModItemComponent component = ((Component)<item>P).GetComponent<ModItemComponent>(); if ((Object)(object)component != (Object)null) { component.InitializeModItem(owner); } NetworkPrefabManager.RegisterNetworkPrefab(owner, "0_Items/", ((Component)<item>P).gameObject); s_RegisteredItems.Add(val); ItemRegistrar.RegisterIfTooLate(val); return val; } IRegisteredContent IContent.Register(ModDefinition owner) { return (IRegisteredContent)(object)Register(owner); } public IContent Resolve() { return (IContent)(object)this; } } internal static class ItemRegistrar { internal static ItemDatabase? ItemDatabaseLoaded; private static Dictionary<string, Shader> _peakShaders; internal static Dictionary<string, Shader> PeakShaders { get { if (_peakShaders == null) { List<string> list = new List<string> { "W/Peak_Standard", "W/Character", "W/Peak_Transparent", "W/Peak_Glass", "W/Peak_Clip", "W/Peak_glass_liquid", "W/Peak_GroundTransition", "W/Peak_Guidebook", "W/Peak_Honey", "W/Peak_Ice", "W/Peak_Rock", "W/Peak_Rope", "W/Peak_Splash", "W/Peak_Waterfall", "W/Vine" }; _peakShaders = new Dictionary<string, Shader>(); foreach (string item in list) { Shader val = Shader.Find(item); if ((Object)(object)val == (Object)null) { ItemsPlugin.Log.LogWarning((object)("PeakShaders: Shader " + item + " was not found.")); } else { _peakShaders[item] = val; } } } return _peakShaders; } } internal static void RegisterIfTooLate(RegisteredContent<ItemContent> registeredItem) { if ((Object)(object)ItemDatabaseLoaded != (Object)null) { FinishRegisterItem(ItemDatabaseLoaded, registeredItem); } } internal static void FinishRegisterItem(ItemDatabase self, RegisteredContent<ItemContent> registeredItem) { Item item = registeredItem.Content.Item; byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(registeredItem.Mod.Id + ((Object)item).name)); item.itemID = BitConverter.ToUInt16(value, 0); if (self.itemLookup.ContainsKey(item.itemID)) { string arg = registeredItem.Mod.Id + ":" + ((Object)item).name; ItemsPlugin.Log.LogWarning((object)string.Format("{0}: Collision on hash itemID '{1}' for '{2}'", "FinishRegisterItem", item.itemID, arg)); if (!TryResolveCollision(self, ref item.itemID)) { ItemsPlugin.Log.LogError((object)string.Format("{0}: Could not resolve collision on itemID '{1}' for '{2}'", "FinishRegisterItem", item.itemID, arg)); return; } ItemsPlugin.Log.LogWarning((object)string.Format("{0}: itemID changed to '{1}' for '{2}'", "FinishRegisterItem", item.itemID, arg)); } Renderer[] componentsInChildren = ((Component)item).GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { Material[] materials = val.materials; foreach (Material val2 in materials) { if (PeakShaders.TryGetValue(((Object)val2.shader).name, out Shader value2)) { val2.shader = value2; } } } ParticleSystem componentInChildren = ((Component)item).gameObject.GetComponentInChildren<ParticleSystem>(); if ((Object)(object)componentInChildren != (Object)null) { ParticleSystemRenderer component = ((Component)componentInChildren).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { Material val3 = Resources.FindObjectsOfTypeAll<Material>().ToList().Find((Material x) => ((Object)x).name == "Smoke"); if ((Object)(object)val3 != (Object)null) { ((Renderer)component).material = val3; } else { ItemsPlugin.Log.LogWarning((object)("Smoke material not found for " + ((Object)item).name)); } } else { ItemsPlugin.Log.LogWarning((object)("ParticleSystemRenderer not found for " + ((Object)item).name)); } } ((DatabaseAsset<ItemDatabase, Item>)(object)self).Objects.Add(item); self.itemLookup.Add(item.itemID, item); } private static bool TryResolveCollision(ItemDatabase self, ref ushort id) { for (ushort num = (ushort)(id + 1); num != id; num++) { if (!self.itemLookup.ContainsKey(num)) { id = num; return true; } } return false; } } public abstract class ModItemComponent : ItemComponent { private ModDefinition? _mod; [HideInInspector] [SerializeField] private string _modId; public ModDefinition Mod { get { if (_mod != null) { return _mod; } if (!ModDefinition.TryGetMod(_modId, ref _mod)) { throw new NullReferenceException("ModItemComponent's Mod property was null meaning it wasn't initialized by PEAKLib!"); } return _mod; } } internal void InitializeModItem(ModDefinition mod) { _modId = ThrowHelper.ThrowIfArgumentNull<ModDefinition>(mod, "mod").Id; } public bool TryGetModItemDataFromJson<T>([MaybeNullWhen(false)] out T data) { return ((ItemComponent)(object)this).TryGetModItemDataFromJson<T>(Mod, out data); } public bool TryGetRawModItemData([NotNullWhen(true)] out byte[]? rawData) { return ((ItemComponent)(object)this).TryGetRawModItemData(Mod, out rawData); } public void SetModItemDataFromJson(object? data) { ((ItemComponent)(object)this).SetModItemDataFromJson(Mod, data); } public void SetRawModItemData(byte[] rawData) { ((ItemComponent)(object)this).SetRawModItemData(Mod, rawData); } } internal class ModItemData : DataEntryValue { public Dictionary<int, byte[]> Value = new Dictionary<int, byte[]>(); public override void SerializeValue(BinarySerializer serializer) { serializer.WriteInt(Value.Count); foreach (KeyValuePair<int, byte[]> item in Value) { serializer.WriteInt(item.Key); serializer.WriteInt(item.Value.Length); serializer.WriteBytes(item.Value); } } public override void DeserializeValue(BinaryDeserializer deserializer) { int num = deserializer.ReadInt(); for (int i = 0; i < num; i++) { int key = deserializer.ReadInt(); int num2 = deserializer.ReadInt(); Value[key] = deserializer.ReadBytes(num2); } } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"ModItemData({Value.Count}) {{ "); foreach (KeyValuePair<int, byte[]> item in Value) { string arg = BitConverter.ToString(item.Value); stringBuilder.Append($"{item.Key}=[{arg}], "); } stringBuilder.Append("}"); return stringBuilder.ToString(); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.github.PEAKModding.PEAKLib.Items", "PEAKLib.Items", "1.5.3")] public class ItemsPlugin : BaseUnityPlugin { public const string Id = "com.github.PEAKModding.PEAKLib.Items"; internal static ManualLogSource Log { get; } = Logger.CreateLogSource(Name); public static string Name => "PEAKLib.Items"; public static string Version => "1.5.3"; private void Awake() { MonoDetourManager.InvokeHookInitializers(typeof(ItemsPlugin).Assembly); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } } } namespace PEAKLib.Items.UnityEditor { [CreateAssetMenu(fileName = "ItemContent", menuName = "PEAKLib/ItemContent", order = 1)] public class UnityItemContent : ScriptableObject, IItemContent, IContent { internal static readonly Dictionary<UnityItemContent, ItemContent> s_UnityToModItem = new Dictionary<UnityItemContent, ItemContent>(); public string Name { get { if ((Object)(object)ItemPrefab == (Object)null) { return ((Object)this).name; } Item component = ItemPrefab.GetComponent<Item>(); if ((Object)(object)component == (Object)null) { return ((Object)this).name; } return ((Object)component).name; } } public Item Item => Resolve().Item; [field: SerializeField] public GameObject ItemPrefab { get; private set; } public IRegisteredContent Register(ModDefinition owner) { return (IRegisteredContent)(object)Resolve().Register(owner); } public ItemContent Resolve() { if (s_UnityToModItem.TryGetValue(this, out ItemContent value)) { return value; } Item item = ThrowHelper.ThrowIfFieldNull<GameObject>(ItemPrefab, "ItemPrefab").GetComponent<Item>() ?? throw new NullReferenceException("Item component on ItemPrefab is null!"); value = new ItemContent(item); s_UnityToModItem.Add(this, value); return value; } IContent IContent.Resolve() { return (IContent)(object)Resolve(); } } } namespace PEAKLib.Items.ItemAcceptor { public interface IItemAcceptor { bool SecondaryInteractOnly { get; } void AcceptItem(Item item, Character interactor); bool AllowInteraction(); string GetPrompt(); static bool TryGetItemAcceptors(IInteractible? interactible, out IEnumerable<IItemAcceptor> itemAcceptors) { MonoBehaviour val = (MonoBehaviour)(object)((interactible is MonoBehaviour) ? interactible : null); if ((Object)(object)val != (Object)null) { itemAcceptors = from x in ((Component)val).GetComponents<IItemAcceptor>() where x.AllowInteraction() select x; } else { itemAcceptors = Array.Empty<IItemAcceptor>(); } return itemAcceptors.Any(); } static void ConsumeOneUse(Item item) { ConsumeUses(item, 1); } static void ConsumeAllUses(Item item) { ConsumeUses(item, item.totalUses); } static void ConsumeEntireItem(Item item) { ((MonoBehaviour)item).StartCoroutine(item.ConsumeDelayed(true)); } internal static void ConsumeUses(Item item, int uses) { Action_ReduceUses component = ((Component)item).GetComponent<Action_ReduceUses>(); if ((Object)(object)component == (Object)null) { if (item.totalUses <= 1) { ConsumeEntireItem(item); } else { ItemsPlugin.Log.LogWarning((object)$"{item} is multi-use but lacks the Action_ReduceUses component."); } } else { for (int i = 0; i < uses; i++) { ((ItemActionBase)component).RunAction(); } } } } } namespace PEAKLib.Items.ItemAcceptor.Hooks { [MonoDetourTargets(typeof(GUIManager), Members = new string[] { "RefreshInteractablePrompt" })] internal class GUIManagerHooks { [MonoDetourHookInitialize] private static void Init() { RefreshInteractablePrompt.Postfix(Postfix_RefreshInteractablePrompt); } private static void Postfix_RefreshInteractablePrompt(GUIManager self) { if (!ClassExtensionsMethods.UnityObjectExists<IInteractible>(self.currentInteractable) || !IItemAcceptor.TryGetItemAcceptors(self.currentInteractable, out IEnumerable<IItemAcceptor> itemAcceptors)) { return; } self.interactName.SetActive(false); if (Object.op_Implicit((Object)(object)Character.localCharacter.data.currentItem) && Character.localCharacter.data.currentItem.canUseOnFriend) { self.interactPromptSecondary.SetActive(true); ((TMP_Text)self.secondaryInteractPromptText).text = itemAcceptors.First().GetPrompt(); if (itemAcceptors.All((IItemAcceptor x) => x.SecondaryInteractOnly)) { self.interactPromptPrimary.SetActive(false); } } } } [MonoDetourTargets(typeof(Interaction))] internal class InteractionHooks { internal static IEnumerable<IItemAcceptor> itemAcceptors = Array.Empty<IItemAcceptor>(); [MonoDetourHookInitialize] private static void Init() { LateUpdate.Postfix(Postfix_LateUpdate); } private static void Postfix_LateUpdate(Interaction self) { IItemAcceptor.TryGetItemAcceptors(self.bestInteractable, out itemAcceptors); } } [MonoDetourTargets(typeof(Item))] internal class ItemHooks { [MonoDetourHookInitialize] private static void Init() { CanUseSecondary.Postfix(Postfix_CanUseSecondary); StartUseSecondary.Postfix(Postfix_StartUseSecondary); FinishCastSecondary.Postfix(Postfix_FinishCastSecondary); } private static void FeedItem(IItemAcceptor itemAcceptor, Item item, Character interactor) { itemAcceptor?.AcceptItem(item, interactor); } private static void Postfix_CanUseSecondary(Item self, ref bool returnValue) { returnValue = returnValue || (self.canUseOnFriend && InteractionHooks.itemAcceptors.Any()); } private static void Postfix_StartUseSecondary(Item self) { if (!self.isUsingPrimary && !self.isUsingSecondary && Object.op_Implicit((Object)(object)self.holderCharacter) && self.canUseOnFriend && InteractionHooks.itemAcceptors.Any()) { GameUtils.instance.StartFeed(((MonoBehaviourPun)self.holderCharacter).photonView.ViewID, ((MonoBehaviourPun)self.holderCharacter).photonView.ViewID, self.itemID, self.totalSecondaryUsingTime); } } private static void Postfix_FinishCastSecondary(Item self) { if (!self.canUseOnFriend || !InteractionHooks.itemAcceptors.Any()) { return; } foreach (IItemAcceptor itemAcceptor in InteractionHooks.itemAcceptors) { FeedItem(itemAcceptor, self, self.holderCharacter); } ((MonoBehaviourPun)self).photonView.RPC("RemoveFeedDataRPC", (RpcTarget)0, new object[1] { ((MonoBehaviourPun)self.holderCharacter).photonView.ViewID }); } } } namespace PEAKLib.Items.Hooks { [MonoDetourTargets(typeof(DataEntryValue), GenerateControlFlowVariants = true)] internal static class DataEntryValueHooks { public const byte PEAKLIB_MOD_TYPE_INDEX = 42; [MonoDetourHookInitialize] private static void Init() { GetTypeValue.Postfix(Postfix_GetTypeValue); GetNewFromValue.ControlFlowPrefix(Prefix_GetNewFromValue); } private static void Postfix_GetTypeValue(ref Type type, ref byte returnValue) { if (returnValue == 0 && type == typeof(ModItemData)) { returnValue = 42; } } private static ReturnFlow Prefix_GetNewFromValue(ref byte value, ref DataEntryValue returnValue) { if (value == 42) { returnValue = (DataEntryValue)(object)new ModItemData(); return (ReturnFlow)1; } return (ReturnFlow)0; } } [MonoDetourTargets(typeof(ItemDatabase))] internal static class ItemDatabaseHooks { [MonoDetourHookInitialize] private static void Init() { OnLoaded.Prefix(Prefix_OnLoaded); } private static void Prefix_OnLoaded(ItemDatabase self) { foreach (RegisteredContent<ItemContent> s_RegisteredItem in ItemContent.s_RegisteredItems) { ItemRegistrar.FinishRegisterItem(self, s_RegisteredItem); } ItemRegistrar.ItemDatabaseLoaded = self; } } } namespace PEAKLib.Items.Hooks.FeatureSingleHand { [MonoDetourTargets(typeof(CharacterAnimations))] [MonoDetourTargets(typeof(CharacterItems))] internal static class CharacterXHooks { [CompilerGenerated] private static class <>O { public static Manipulator <0>__ILHook_CharacterAnimations_ConfigureIK; public static Manipulator <1>__ILHook_CharacterAnimations_HandleIK; public static Manipulator <2>__ILHook_CharacterItems_AttachItem; public static Func<CharacterAnimations, float> <3>__GetIKWeightsRight; public static Func<CharacterAnimations, float> <4>__GetIKWeightsLeft; public static Func<CharacterAnimations, bool> <5>__HasHandLeft; public static Func<CharacterAnimations, bool> <6>__HasHandRight; public static Func<Item, bool> <7>__HasHandItemRight; public static Func<Item, bool> <8>__HasHandItemLeft; } [MonoDetourHookInitialize] private static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown try { object obj = <>O.<0>__ILHook_CharacterAnimations_ConfigureIK; if (obj == null) { Manipulator val = ILHook_CharacterAnimations_ConfigureIK; <>O.<0>__ILHook_CharacterAnimations_ConfigureIK = val; obj = (object)val; } ConfigureIK.ILHook((Manipulator)obj); object obj2 = <>O.<1>__ILHook_CharacterAnimations_HandleIK; if (obj2 == null) { Manipulator val2 = ILHook_CharacterAnimations_HandleIK; <>O.<1>__ILHook_CharacterAnimations_HandleIK = val2; obj2 = (object)val2; } HandleIK.ILHook((Manipulator)obj2); object obj3 = <>O.<2>__ILHook_CharacterItems_AttachItem; if (obj3 == null) { Manipulator val3 = ILHook_CharacterItems_AttachItem; <>O.<2>__ILHook_CharacterItems_AttachItem = val3; obj3 = (object)val3; } AttachItem.ILHook((Manipulator)obj3); } catch (Exception arg) { ItemsPlugin.Log.LogError((object)$"Exception in single handed items ILHooks: {arg}"); } } private static void ILHook_CharacterAnimations_HandleIK(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); Instruction rightIk = null; Instruction leftIk = null; float num4 = default(float); ILLabel val4 = default(ILLabel); float num3 = default(float); MethodReference val3 = default(MethodReference); float num2 = default(float); MethodReference val2 = default(MethodReference); float num = default(float); MethodReference val = default(MethodReference); w.MatchRelaxed(new Predicate<Instruction>[24] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterAnimations>(x, "character"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<Character>(x, "data"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterData>(x, "overrideIKForSeconds"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num4), (Instruction x) => ILPatternMatchingExt.MatchBgtUn(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterAnimations>(x, "character"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<Character>(x, "refs"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterRefs>(x, "ikRig"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num3), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, ref val3), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterAnimations>(x, "character"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<Character>(x, "refs"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterRefs>(x, "ikRight"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num2) && w.SetInstructionTo(ref rightIk, x), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterAnimations>(x, "character"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<Character>(x, "refs"), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterRefs>(x, "ikLeft"), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num) && w.SetInstructionTo(ref leftIk, x), (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, ref val) }).ThrowIfFailure(); w.InsertAfter(rightIk, (IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[3] { w.Create(OpCodes.Pop), w.Create(OpCodes.Ldarg_0), w.CreateCall((Delegate)new Func<CharacterAnimations, float>(GetIKWeightsRight)) })); w.InsertAfter(leftIk, (IEnumerable<Instruction>)new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[3] { w.Create(OpCodes.Pop), w.Create(OpCodes.Ldarg_0), w.CreateCall((Delegate)new Func<CharacterAnimations, float>(GetIKWeightsLeft)) })); } private static float GetIKWeightsRight(CharacterAnimations self) { if (!HasHandRight(self)) { return 0f; } return 1f; } private static float GetIKWeightsLeft(CharacterAnimations self) { if (!HasHandLeft(self)) { return 0f; } return 1f; } private static void ILHook_CharacterAnimations_ConfigureIK(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) ILWeaver w = new ILWeaver(info); VariableDefinition val = new VariableDefinition(w.Context.Import(typeof(bool))); VariableDefinition val2 = new VariableDefinition(w.Context.Import(typeof(bool))); w.Body.Variables.Add(val); w.Body.Variables.Add(val2); IInformationalMethodBody informationalBody = MethodBodyExtensions.CreateInformationalSnapshotEvaluateAll(w.Body); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterItems>(x, "GetItemPosLeft") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBranchOverIfFalse(w.GetStackSizeZeroAreaContinuous(w.Current, informationalBody), new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[4] { w.Create(OpCodes.Ldarg_0), w.CreateCall((Delegate)new Func<CharacterAnimations, bool>(HasHandLeft)), w.Create(OpCodes.Dup), w.Create(OpCodes.Stloc, val) })); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterItems>(x, "GetItemPosRight") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBranchOverIfFalse(w.GetStackSizeZeroAreaContinuous(w.Current, informationalBody), new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[4] { w.Create(OpCodes.Ldarg_0), w.CreateCall((Delegate)new Func<CharacterAnimations, bool>(HasHandRight)), w.Create(OpCodes.Dup), w.Create(OpCodes.Stloc, val2) })); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterItems>(x, "GetItemRotRight") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBranchOverIfFalse(w.GetStackSizeZeroAreaContinuous(w.Current, informationalBody), new <>z__ReadOnlySingleElementList<Instruction>(w.Create(OpCodes.Ldloc, val2))); w.MatchRelaxed(new Predicate<Instruction>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterItems>(x, "GetItemRotLeft") && w.SetCurrentTo(x) }).ThrowIfFailure().InsertBranchOverIfFalse(w.GetStackSizeZeroAreaContinuous(w.Current, informationalBody), new <>z__ReadOnlySingleElementList<Instruction>(w.Create(OpCodes.Ldloc, val))); } private static void ILHook_CharacterItems_AttachItem(ILManipulationInfo info) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown ILWeaver w = new ILWeaver(info); VariableDefinition hasLeft = new VariableDefinition(w.Context.Import(typeof(bool))); VariableDefinition hasRight = new VariableDefinition(w.Context.Import(typeof(bool))); w.Body.Variables.Add(hasLeft); w.Body.Variables.Add(hasRight); IInformationalMethodBody infoBody = MethodBodyExtensions.CreateInformationalSnapshotEvaluateAll(w.Body); int i = 0; w.MatchMultipleStrict((Action<ILWeaver>)delegate(ILWeaver match) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (i == 0) { match.InsertBranchOverIfFalse(w.GetStackSizeZeroAreaContinuous(w.Current, infoBody), new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[4] { w.Create(OpCodes.Ldarg_1), w.CreateCall((Delegate)new Func<Item, bool>(HasHandItemRight)), w.Create(OpCodes.Dup), w.Create(OpCodes.Stloc, hasRight) })); } else { match.InsertBranchOverIfFalse(w.GetStackSizeZeroAreaContinuous(w.Current, infoBody), new <>z__ReadOnlySingleElementList<Instruction>(w.Create(OpCodes.Ldloc, hasRight))); } i++; }, new Predicate<Instruction>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 10) && w.SetCurrentTo(x), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Character>(x, "GetBodypartRig") }).ThrowIfFailure(); i = 0; w.MatchMultipleStrict((Action<ILWeaver>)delegate(ILWeaver match) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (i == 0) { match.InsertBranchOverIfFalse(w.GetStackSizeZeroAreaContinuous(w.Current, infoBody), new <>z__ReadOnlyArray<Instruction>((Instruction[])(object)new Instruction[4] { w.Create(OpCodes.Ldarg_1), w.CreateCall((Delegate)new Func<Item, bool>(HasHandItemLeft)), w.Create(OpCodes.Dup), w.Create(OpCodes.Stloc, hasLeft) })); } else { match.InsertBranchOverIfFalse(w.GetStackSizeZeroAreaContinuous(w.Current, infoBody), new <>z__ReadOnlySingleElementList<Instruction>(w.Create(OpCodes.Ldloc, hasLeft))); } i++; }, new Predicate<Instruction>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 7) && w.SetCurrentTo(x), (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Character>(x, "GetBodypartRig") }).ThrowIfFailure(); } private static bool HasHandLeft(CharacterAnimations self) { return HasHandItemLeft(self.character.data.currentItem); } private static bool HasHandRight(CharacterAnimations self) { return HasHandItemRight(self.character.data.currentItem); } private static bool HasHandItemLeft(Item item) { return Object.op_Implicit((Object)(object)((Component)item).transform.Find("Hand_L")); } private static bool HasHandItemRight(Item item) { return Object.op_Implicit((Object)(object)((Component)item).transform.Find("Hand_R")); } private static (Instruction start, Instruction end) GetStackSizeZeroAreaContinuous(this ILWeaver weaver, Instruction start, IInformationalMethodBody? informationalBody = null) { if (informationalBody == null) { informationalBody = MethodBodyExtensions.CreateInformationalSnapshotEvaluateAll(weaver.Body); } Instruction stackSizeZeroBeforeContinuous = weaver.GetStackSizeZeroBeforeContinuous(start, informationalBody); Instruction stackSizeZeroAfterContinuous = weaver.GetStackSizeZeroAfterContinuous(start, informationalBody); return (stackSizeZeroBeforeContinuous, stackSizeZeroAfterContinuous); } private static ILWeaver InsertBranchOverIfFalse(this ILWeaver weaver, (Instruction start, Instruction end) range, [ParamCollection] IEnumerable<Instruction> condition) { return weaver.InsertBranchOverIfFalse(range.start, range.end, condition); } private static ILWeaver InsertBranchOverIfFalse(this ILWeaver weaver, Instruction start, Instruction end, [ParamCollection] IEnumerable<Instruction> condition) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) int num = weaver.Instructions.IndexOf(start); weaver.InsertBeforeStealLabels(num, (IEnumerable<Instruction>)new <>z__ReadOnlySingleElementList<Instruction>(weaver.Create(OpCodes.Brfalse, end.Next))); weaver.InsertBeforeStealLabels(num, condition); return weaver; } } } 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 { } } [CompilerGenerated] internal sealed class <>z__ReadOnlyArray<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => _items.Length; T IReadOnlyList<T>.this[int index] => _items[index]; int ICollection<T>.Count => _items.Length; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return ((IEnumerable<T>)_items).GetEnumerator(); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return ((ICollection<T>)_items).Contains(item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { ((ICollection<T>)_items).CopyTo(array, arrayIndex); } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return ((IList<T>)_items).IndexOf(item); } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer<T>.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { if (!EqualityComparer<T>.Default.Equals(_item, item)) { return -1; } return 0; } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }