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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("OldMarket.SellholdMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OldMarket.SellholdMod")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("01c4014e-6c56-431c-ba8a-3c5b76392902")]
[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 OldMarketMods.SellHold;
[BepInPlugin("yourname.oldmarket.sellhold", "Old Market Sell Hold", "1.0.0")]
public class SellHoldPlugin : BaseUnityPlugin
{
public const string PluginGuid = "yourname.oldmarket.sellhold";
public const string PluginName = "Old Market Sell Hold";
public const string PluginVersion = "1.0.0";
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
new Harmony("yourname.oldmarket.sellhold").PatchAll();
}
}
[HarmonyPatch(typeof(PlayerInteraction), "Update")]
internal static class PlayerInteraction_Update_SellHoldPatch
{
private static float _repeatTimer;
private const float RepeatInterval = 0.1f;
private static readonly FieldInfo IsInteractionEnabledField = AccessTools.Field(typeof(PlayerInteraction), "isInteractionEnabled");
private static void Postfix(PlayerInteraction __instance)
{
//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_0064: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
if (IsInteractionEnabledField != null && !(bool)IsInteractionEnabledField.GetValue(__instance))
{
_repeatTimer = 0f;
return;
}
PlayerActions player = InputManager.Instance.inputMaster.Player;
if (!((PlayerActions)(ref player)).PrimaryInteraction.IsPressed())
{
_repeatTimer = 0f;
return;
}
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return;
}
RaycastHit val = default(RaycastHit);
if (!Physics.Raycast(main.ViewportPointToRay(Vector3.one / 2f), ref val, __instance.interactionDistance, LayerMask.op_Implicit(__instance.layerMask), (QueryTriggerInteraction)1))
{
_repeatTimer = 0f;
return;
}
Interactable componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Interactable>();
if ((Object)(object)componentInParent == (Object)null)
{
_repeatTimer = 0f;
return;
}
if (!(componentInParent is CoinPouch) && !((Object)(object)((Component)componentInParent).GetComponentInParent<Checkout>() != (Object)null))
{
_repeatTimer = 0f;
return;
}
if (!componentInParent.CanInteract())
{
_repeatTimer = 0f;
return;
}
if ((int)componentInParent.interactionType != 0)
{
_repeatTimer = 0f;
return;
}
_repeatTimer += Time.deltaTime;
if (_repeatTimer >= 0.1f)
{
_repeatTimer = 0f;
componentInParent.Interact();
}
}
}