using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using Microsoft.CodeAnalysis;
using Mirror;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 AutoCollectStolenGoods
{
[BepInPlugin("com.earlj.supermarkettogether.autocollectstolengoods", "Auto Collect Stolen Goods", "1.0.0")]
public sealed class AutoCollectStolenGoodsPlugin : BaseUnityPlugin
{
private readonly HashSet<int> recoveredObjects = new HashSet<int>();
private float nextScan;
private NPC_Manager currentManager;
private void Update()
{
if (!NetworkServer.active || (Object)(object)NPC_Manager.Instance == (Object)null || (Object)(object)NPC_Manager.Instance.droppedProductsParentOBJ == (Object)null || (Object)(object)GameData.Instance == (Object)null || (Object)(object)StatisticsManager.Instance == (Object)null)
{
recoveredObjects.Clear();
currentManager = null;
nextScan = 0f;
return;
}
if ((Object)(object)currentManager != (Object)(object)NPC_Manager.Instance)
{
recoveredObjects.Clear();
currentManager = NPC_Manager.Instance;
nextScan = 0f;
}
if (Time.unscaledTime < nextScan)
{
return;
}
nextScan = Time.unscaledTime + 0.25f;
StolenProductSpawn[] componentsInChildren = currentManager.droppedProductsParentOBJ.GetComponentsInChildren<StolenProductSpawn>();
foreach (StolenProductSpawn val in componentsInChildren)
{
if (!((Object)(object)val == (Object)null) && ((NetworkBehaviour)val).isServer && ((NetworkBehaviour)val).netId != 0 && recoveredObjects.Add(((Object)val).GetInstanceID()))
{
val.RecoverStolenProductFromEmployee();
}
}
}
}
}