using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("NoForcedDropMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoForcedDropMod")]
[assembly: AssemblyTitle("NoForcedDropMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace NoForcedDropMod
{
[BepInPlugin("com.mistyck.noforceddrop", "No Forced Drop Mod", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("com.mistyck.noforceddrop").PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"No Forced Drop Mod loaded!");
}
}
[HarmonyPatch(typeof(PhysGrabber), "ReleaseObject")]
public class ReleaseObject_Patch
{
private static bool Prefix(object __instance)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
FieldInfo fieldInfo = AccessTools.Field(__instance.GetType(), "grabbedObject");
FieldInfo fieldInfo2 = AccessTools.Field(__instance.GetType(), "prevGrabbed");
if (fieldInfo == null || fieldInfo2 == null)
{
Debug.LogWarning((object)"NoForcedDropMod: Could not find necessary fields in PhysGrabber.");
return true;
}
Rigidbody val = (Rigidbody)fieldInfo.GetValue(__instance);
bool flag = (bool)fieldInfo2.GetValue(__instance);
if ((Object)(object)val == (Object)null || !flag)
{
return true;
}
((Component)val).gameObject.SetActive(false);
Debug.Log((object)"NoForcedDropMod: Item stored instead of dropped.");
return false;
}
}
}