using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BoneLib.BoneMenu; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.Pool; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSystem; using InfiniteHolsters; using LabFusion.Entities; using LabFusion.Network; using LabFusion.RPC; using MelonLoader; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(InfiniteHoldersMod), "InfiniteHolsters", "1.0.0", "Brissanna", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("InfiniteHolsters")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("InfiniteHolsters")] [assembly: AssemblyTitle("InfiniteHolsters")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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; } } } namespace InfiniteHolsters { public class InfiniteHoldersMod : MelonMod { private static bool modEnabled = true; public static readonly HashSet busySlots = new HashSet(); public static bool IsModEnabled => modEnabled; public override void OnInitializeMelon() { //IL_0017: 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) MelonLogger.Msg("InfiniteHolsters loaded!"); try { Page val = Page.Root.CreatePage("Infinite Holsters", Color.white, 0, true); val.CreateBool("Enabled", Color.white, modEnabled, (Action)OnToggleChanged); MelonLogger.Msg("InfiniteHolsters BoneMenu page created successfully!"); } catch (Exception value) { MelonLogger.Error($"InfiniteHolsters failed to create BoneMenu page: {value}"); } ((MelonBase)this).HarmonyInstance.PatchAll(); MelonLogger.Msg("InfiniteHolsters Harmony patches applied!"); } private void OnToggleChanged(bool value) { modEnabled = value; MelonLogger.Msg($"InfiniteHolsters enabled: {modEnabled}"); } } [HarmonyPatch(typeof(InventorySlotReceiver), "OnHandGrab", new Type[] { typeof(Hand) })] public static class InventorySlotReceiver_OnHandGrab_Patch { public static void Prefix(InventorySlotReceiver __instance, Hand hand) { //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01ba: Expected O, but got Unknown //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) if (!InfiniteHoldersMod.IsModEnabled || (Object)(object)__instance == (Object)null || InfiniteHoldersMod.busySlots.Contains(__instance)) { return; } InfiniteHoldersMod.busySlots.Add(__instance); WeaponSlot slottedWeapon = __instance._slottedWeapon; if ((Object)(object)slottedWeapon == (Object)null) { InfiniteHoldersMod.busySlots.Remove(__instance); return; } InteractableHost host = slottedWeapon.interactableHost; if ((Object)(object)host == (Object)null) { InfiniteHoldersMod.busySlots.Remove(__instance); return; } GameObject hostGameObject = host.GetHostGameObject(); if ((Object)(object)hostGameObject == (Object)null) { InfiniteHoldersMod.busySlots.Remove(__instance); return; } Poolee component = hostGameObject.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component.SpawnableCrate == (Object)null) { InfiniteHoldersMod.busySlots.Remove(__instance); return; } Barcode barcode = ((Scannable)component.SpawnableCrate).Barcode; MelonLogger.Msg("InfiniteHolsters: grabbed item from slot, barcode found."); Gun component2 = hostGameObject.GetComponent(); if ((Object)(object)component2 != (Object)null && !component2.isLoaded) { component2.InstantLoadAsync(); component2.CeaseFire(); component2.Charge(); MelonCoroutines.Start(FixGunSlideAfterLoad(component2)); MelonLogger.Msg("InfiniteHolsters: original gun was unloaded, loaded it on pull."); } Spawnable val = new Spawnable { crateRef = new SpawnableCrateReference(barcode) }; Vector3 position = ((Component)__instance).transform.position; if (NetworkInfo.HasServer) { MelonLogger.Msg("InfiniteHolsters: spawning via NetworkAssetSpawner (Fusion session active)."); SpawnRequestInfo val2 = new SpawnRequestInfo { Spawnable = val, Position = position, Rotation = Quaternion.identity, SpawnEffect = false, SpawnSource = (EntitySource)0, SpawnCallback = delegate(SpawnCallbackInfo info) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) HandleSpawnedReplacement(__instance, info.Spawned, host); } }; NetworkAssetSpawner.Spawn(val2); } else { AssetSpawner.Spawn(val, position, Quaternion.identity, new Nullable(), (Transform)null, false, new Nullable(), (Action)null, (Action)null); MelonCoroutines.Start(WaitAndInsertReplacement(__instance, position, barcode, host)); } } private static void HandleSpawnedReplacement(InventorySlotReceiver receiver, GameObject spawnedGo, InteractableHost originalHost) { if ((Object)(object)spawnedGo == (Object)null) { MelonLogger.Warning("InfiniteHolsters: networked spawn callback returned a null GameObject."); InfiniteHoldersMod.busySlots.Remove(receiver); return; } InteractableHost component = spawnedGo.GetComponent(); if ((Object)(object)component == (Object)null) { MelonLogger.Warning("InfiniteHolsters: networked replacement had no InteractableHost component."); InfiniteHoldersMod.busySlots.Remove(receiver); return; } if (!receiver.InsertInSlot(component)) { MelonLogger.Warning("InfiniteHolsters: InsertInSlot failed for '" + ((Object)spawnedGo).name + "' (networked)."); } else { Gun component2 = spawnedGo.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.InstantLoadAsync(); component2.CeaseFire(); component2.Charge(); MelonCoroutines.Start(FixGunSlideAfterLoad(component2)); } } InfiniteHoldersMod.busySlots.Remove(receiver); } private static IEnumerator WaitAndInsertReplacement(InventorySlotReceiver receiver, Vector3 spawnPos, Barcode expectedBarcode, InteractableHost originalHost) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) yield return null; yield return null; Collider[] nearby = Il2CppArrayBase.op_Implicit((Il2CppArrayBase)(object)Physics.OverlapSphere(spawnPos, 0.2f)); InteractableHost foundHost = null; Collider[] array = nearby; foreach (Collider col in array) { if ((Object)(object)col == (Object)null) { continue; } Poolee candidatePoolee = ((Component)col).GetComponentInParent(); if (!((Object)(object)candidatePoolee == (Object)null) && !((Object)(object)candidatePoolee.SpawnableCrate == (Object)null) && !(((Scannable)candidatePoolee.SpawnableCrate).Barcode != expectedBarcode)) { InteractableHost candidate = ((Component)candidatePoolee).gameObject.GetComponent(); if (!((Object)(object)candidate == (Object)null) && !((Object)(object)candidate == (Object)(object)originalHost) && (!((Object)(object)receiver._slottedWeapon != (Object)null) || !((Object)(object)receiver._slottedWeapon.interactableHost == (Object)(object)candidate))) { foundHost = candidate; break; } } } if ((Object)(object)foundHost == (Object)null) { MelonLogger.Warning("InfiniteHolsters: couldn't find spawned replacement near slot position."); InfiniteHoldersMod.busySlots.Remove(receiver); yield break; } if (!receiver.InsertInSlot(foundHost)) { MelonLogger.Warning("InfiniteHolsters: InsertInSlot failed for '" + ((Object)((Component)foundHost).gameObject).name + "'."); } else { Gun gun = ((Component)foundHost).gameObject.GetComponent(); if ((Object)(object)gun != (Object)null && (Object)(object)gun.ammoSocket != (Object)null && (Object)(object)gun.defaultMagazine != (Object)null) { gun.ammoSocket.ForceLoadAsync(gun.defaultMagazine); gun.CeaseFire(); gun.Charge(); MelonCoroutines.Start(FixGunSlideAfterLoad(gun)); } } InfiniteHoldersMod.busySlots.Remove(receiver); } private static IEnumerator FixGunSlideAfterLoad(Gun gun) { yield return null; yield return null; yield return null; if ((Object)(object)gun != (Object)null) { gun.CompleteSlidePull(); gun.CompleteSlideReturn(); } } } }