using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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("SimplyLethalCompanyCounterIncrease")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SimplyLethalCompanyCounterIncrease")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("677C2E0C-1E03-42DD-A998-A226F4091793")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SimplyLethalCompanyCounterIncrease;
[BepInPlugin("SimplexityDev.SimplyLethalCompanyCounterIncrease", "Simply Lethal Company Counter Increase", "1.0.0.0")]
[HarmonyPatch]
public class Main : BaseUnityPlugin
{
private const string modGUID = "SimplexityDev.SimplyLethalCompanyCounterIncrease";
private const string modName = "Simply Lethal Company Counter Increase";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("SimplexityDev.SimplyLethalCompanyCounterIncrease");
private static ManualLogSource logger;
private static int maxItemsOnDesk = 30;
private void Awake()
{
logger = Logger.CreateLogSource("SimplexityDev.SimplyLethalCompanyCounterIncrease");
harmony.PatchAll();
}
[HarmonyPatch(typeof(DepositItemsDesk), "PlaceItemOnCounter")]
private static void Postfix(DepositItemsDesk __instance, PlayerControllerB playerWhoTriggered)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.inGrabbingObjectsAnimation && ((Component)__instance.deskObjectsContainer).GetComponentsInChildren<GrabbableObject>().Length >= 12 && ((Component)__instance.deskObjectsContainer).GetComponentsInChildren<GrabbableObject>().Length < maxItemsOnDesk && (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);
logger.LogDebug((object)"discard held object called from deposit items desk");
}
}
}