using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BetterUtilitySlot")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+a0a58f976518357adc552c8b0b6ca67d8009b1f1")] [assembly: AssemblyProduct("BetterUtilitySlot")] [assembly: AssemblyTitle("BetterUtilitySlot")] [assembly: AssemblyVersion("1.0.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BetterUtilitySlot { [BepInPlugin("ZaboomafooW.BetterUtilitySlot", "BetterUtilitySlot", "1.0.2")] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "ZaboomafooW.BetterUtilitySlot"; public const string PluginName = "BetterUtilitySlot"; public const string PluginVersion = "1.0.2"; private Harmony _harmony; internal static ManualLogSource Log { get; private set; } private void Awake() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; _harmony = new Harmony("ZaboomafooW.BetterUtilitySlot"); _harmony.PatchAll(); Log.LogInfo((object)"[BetterUtilitySlot] Loaded v1.0.2"); Log.LogInfo((object)"[BetterUtilitySlot] Hook succeeded: v81 vanilla utility-slot eligibility override attached."); } private void OnApplicationQuit() { if (_harmony != null) { _harmony.UnpatchSelf(); _harmony = null; } Log = null; } } } namespace BetterUtilitySlot.Patches { [HarmonyPatch(typeof(PlayerControllerB), "FirstEmptyItemSlot")] internal static class UtilitySlotEligibilityPatch { private const int UtilitySlot = 50; private static bool _loggedEligibility; [HarmonyPostfix] private static void Postfix(PlayerControllerB __instance, GrabbableObject attemptingGrab, ref int __result) { if (__result == 50 || __instance.ItemOnlySlot != null || attemptingGrab == null || attemptingGrab.itemProperties == null) { return; } Item itemProperties = attemptingGrab.itemProperties; if (itemProperties.isScrap || itemProperties.twoHanded || !itemProperties.disallowUtilitySlot) { return; } __result = 50; if (!_loggedEligibility) { _loggedEligibility = true; ManualLogSource log = Plugin.Log; if (log != null) { log.LogInfo((object)string.Format("[{0}] Feature executed: allowed a vanilla disallowUtilitySlot item into utility slot {1}.", "BetterUtilitySlot", 50)); } } } } }