Decompiled source of Unlimited Sell Mod v1.0.0

UnlimitedSellMod.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
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("UnlimitedSellMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UnlimitedSellMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("23f41b2b-809b-4f31-a434-e301db4270ea")]
[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 UnlimitedSell;

[BepInPlugin("orangesoft.UnlimitedSellMod", "Unlimited Sell", "1.0.0")]
public class UnlimitedSellModBase : BaseUnityPlugin
{
	public class DepositItemsPatch
	{
		public static bool PlaceItemsPatch(DepositItemsDesk __instance, PlayerControllerB playerWhoTriggered)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_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_0073: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)playerWhoTriggered == (Object)(object)GameNetworkManager.Instance.localPlayerController)
			{
				Vector3 val = RoundManager.RandomPointInBounds(((Collider)__instance.triggerCollider).bounds);
				Bounds bounds = ((Collider)__instance.triggerCollider).bounds;
				val.y = ((Bounds)(ref bounds)).min.y;
				RaycastHit val2 = default(RaycastHit);
				if (Physics.Raycast(new Ray(val + Vector3.up * 3f, Vector3.down), ref val2, 8f, 1048640, (QueryTriggerInteraction)2))
				{
					val = ((RaycastHit)(ref val2)).point;
				}
				val.y += playerWhoTriggered.currentlyHeldObjectServer.itemProperties.verticalOffset;
				val = ((Component)__instance.deskObjectsContainer).transform.InverseTransformPoint(val);
				__instance.AddObjectToDeskServerRpc(NetworkObjectReference.op_Implicit(((Component)playerWhoTriggered.currentlyHeldObjectServer).gameObject.GetComponent<NetworkObject>()));
				playerWhoTriggered.DiscardHeldObject(true, __instance.deskObjectsContainer, val, false);
				Debug.Log((object)"discard held object called from deposit items desk");
			}
			return false;
		}
	}

	private const string modGUID = "orangesoft.UnlimitedSellMod";

	private const string modName = "Unlimited Sell";

	private const string modVersion = "1.0.0";

	public void Awake()
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Expected O, but got Unknown
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Unlimited Sell Mod Loaded");
		Harmony val = new Harmony("orangesoft.UnlimitedSellMod");
		MethodInfo methodInfo = AccessTools.Method(typeof(DepositItemsDesk), "PlaceItemOnCounter", (Type[])null, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(typeof(DepositItemsPatch), "PlaceItemsPatch", (Type[])null, (Type[])null);
		val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
	}
}