using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("StationAutoPopper")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("PlugNPlay")]
[assembly: AssemblyProduct("StationAutoPopper")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4358610B-F3F4-4843-B7AF-98B7BC60DCDE")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 StationAutoPopper
{
[BepInPlugin("PlugNPlay.StationAutoPopper", "StationAutoPopper", "1.0.0")]
public class StationAutoPopperPlugin : BaseUnityPlugin
{
internal const string ModName = "StationAutoPopper";
internal const string ModVersion = "1.0.0";
internal const string Author = "PlugNPlay";
private const string ModGUID = "PlugNPlay.StationAutoPopper";
private readonly Harmony _harmony = new Harmony("PlugNPlay.StationAutoPopper");
public static readonly ManualLogSource StationAutoPopperLogger = Logger.CreateLogSource("StationAutoPopper");
public void Awake()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
_harmony.PatchAll(executingAssembly);
}
}
[HarmonyPatch(typeof(CookingStation), "UpdateCooking")]
public static class AutoPopItemsFromCookingStation_UpdateCooking_Patch
{
[ThreadStatic]
private static int[] _poppedSlots;
private static void Prefix(CookingStation __instance)
{
int num = __instance.m_slots.Length;
if (_poppedSlots == null || _poppedSlots.Length != num)
{
_poppedSlots = new int[num];
}
for (int i = 0; i < num; i++)
{
_poppedSlots[i] = 0;
}
}
private static void Postfix(CookingStation __instance)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_0084: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance.m_nview == (Object)null || !__instance.m_nview.IsOwner())
{
return;
}
int num = __instance.m_slots.Length;
ZNetView nview = __instance.m_nview;
Vector3 val = (((Object)(object)__instance.m_spawnPoint != (Object)null) ? __instance.m_spawnPoint.position : (((Component)__instance).transform.position + Vector3.up * 0.5f));
string text = default(string);
float num2 = default(float);
Status val2 = default(Status);
for (int i = 0; i < num; i++)
{
if (_poppedSlots[i] == 0)
{
__instance.GetSlot(i, ref text, ref num2, ref val2);
if ((int)val2 == 1)
{
nview.InvokeRPC(ZNetView.Everybody, "RPC_RemoveDoneItem", new object[2] { val, 1 });
_poppedSlots[i] = 1;
}
}
}
}
}
}