using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UniversalBag")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UniversalBag")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aab4254f-f34f-43b4-8c28-bbda39464ea6")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace UniversalBag;
[BepInPlugin("UniversalBag", "UniversalBag", "1.0.0")]
public class UniversalBagPlugin : BaseUnityPlugin
{
public const string Version = "1.0.0";
[HarmonyPatch(typeof(BeltBagItem), "ItemInteractLeftRight")]
[HarmonyPrefix]
[HarmonyWrapSafe]
public static bool ItemInteractLeftRight(BeltBagItem __instance, bool right)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null || __instance.tryingAddToBag || __instance.objectsInBag.Count >= 15 || right)
{
return false;
}
Debug.DrawRay(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward * 4f, Color.red, 2f);
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.position, ((Component)((GrabbableObject)__instance).playerHeldBy.gameplayCamera).transform.forward, ref val, 4f, 1073742144, (QueryTriggerInteraction)1))
{
RaycastHit val2 = val;
GrabbableObject component = ((Component)((RaycastHit)(ref val2)).collider).gameObject.GetComponent<GrabbableObject>();
if (!((Object)(object)component == (Object)null) && !((Object)(object)component == (Object)(object)__instance) && !component.isHeld)
{
__instance.TryAddObjectToBag(component);
}
}
return false;
}
private void Awake()
{
Harmony.CreateAndPatchAll(typeof(UniversalBagPlugin), (string)null);
}
}