Decompiled source of LethalWashing v1.4.0

plugins/Snowlance.LethalWashing.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Dawn;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Snowlance.LethalWashing.NetcodePatcher;
using SnowyLib;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: AssemblyCompany("Snowlance.LethalWashing")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0+cdf5be96a5feaa3e83056739d5907a642d692202")]
[assembly: AssemblyProduct("LethalWashing")]
[assembly: AssemblyTitle("Snowlance.LethalWashing")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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 LethalWashing
{
	internal class CoinBehavior : PhysicsProp
	{
		public AudioSource audioSource = null;

		public Animator animator = null;

		public List<AudioClip> coinDropSFXs = new List<AudioClip>();

		public void Awake()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).itemProperties.positionOffset = new Vector3(0.06f, 0.14f, 0f);
			((GrabbableObject)this).itemProperties.rotationOffset = new Vector3(-60f, 60f, 225f);
			((GrabbableObject)this).itemProperties.floorYOffset = 90;
			audioSource.volume = 0.5f;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (buttonDown)
			{
				FlipCoinServerRpc();
			}
		}

		public override void OnHitGround()
		{
			((GrabbableObject)this).OnHitGround();
			RoundManager.PlayRandomClip(audioSource, coinDropSFXs.ToArray(), true, 1f, 0, 1000);
		}

		[ServerRpc(RequireOwnership = false)]
		public void FlipCoinServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1651802722u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 1651802722u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (((NetworkBehaviour)this).IsServer)
				{
					FlipCoinClientRpc();
				}
			}
		}

		[ClientRpc]
		public void FlipCoinClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1488140613u, val2, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 1488140613u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					audioSource.Play();
					animator.SetTrigger("flip");
				}
			}
		}

		[ClientRpc]
		public void SetScrapValueClientRpc(int setValueTo)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1957598905u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, setValueTo);
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 1957598905u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					Plugin.logger.LogDebug((object)"EjectFromWashingMachineClientRpc");
					((GrabbableObject)this).SetScrapValue(setValueTo);
					RoundManager.PlayRandomClip(audioSource, coinDropSFXs.ToArray(), true, 1f, 0, 1000);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((PhysicsProp)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1651802722u, new RpcReceiveHandler(__rpc_handler_1651802722), "FlipCoinServerRpc");
			((NetworkBehaviour)this).__registerRpc(1488140613u, new RpcReceiveHandler(__rpc_handler_1488140613), "FlipCoinClientRpc");
			((NetworkBehaviour)this).__registerRpc(1957598905u, new RpcReceiveHandler(__rpc_handler_1957598905), "SetScrapValueClientRpc");
			((PhysicsProp)this).__initializeRpcs();
		}

		private static void __rpc_handler_1651802722(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CoinBehavior)(object)target).FlipCoinServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1488140613(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CoinBehavior)(object)target).FlipCoinClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1957598905(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int scrapValueClientRpc = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref scrapValueClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CoinBehavior)(object)target).SetScrapValueClientRpc(scrapValueClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "CoinBehavior";
		}
	}
	public static class Configs
	{
		public static string Blacklist => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<string>("Blacklist").Value;

		public static bool PreventDespawnOnTeamWipe => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<bool>("Prevent Despawn On Team Wipe").Value;

		public static string TeamWipeBlacklist => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<string>("Team Wipe Blacklist").Value;

		public static float WashTime => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<float>("Wash Time").Value;

		public static bool UsableOnlyOnCompanyDay => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<bool>("Usable Only On Company Day").Value;

		public static bool CombineCoinValues => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<bool>("Combine Coin Values").Value;

		public static int CoinsToSpawn => ((AssetBundleLoader<LethalWashingContentHandler.WashingMachineAssets>)(object)ContentHandler<LethalWashingContentHandler>.Instance.WashingMachine).GetConfig<int>("Coins To Spawn").Value;
	}
	public class LethalWashingContentHandler : ContentHandler<LethalWashingContentHandler>
	{
		public class WashingMachineAssets : AssetBundleLoader<WashingMachineAssets>
		{
			public WashingMachineAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		public WashingMachineAssets? WashingMachine;

		public LethalWashingContentHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<WashingMachineAssets>("washing_machine", ref WashingMachine, true);
		}
	}
	public static class LethalWashingKeys
	{
		public const string Namespace = "lethalwashing";

		internal static NamespacedKey LastVersion = NamespacedKey.From("lethalwashing", "last_version");

		public static readonly NamespacedKey<DawnUnlockableItemInfo> WashingMachine = NamespacedKey<DawnUnlockableItemInfo>.From("lethalwashing", "washing_machine");

		public static readonly NamespacedKey<DawnItemInfo> Coin = NamespacedKey<DawnItemInfo>.From("lethalwashing", "coin");
	}
	[HarmonyPatch]
	internal class Patches
	{
		private static string[] teamWipeBlacklist = Array.Empty<string>();

		private static bool despawningProps = false;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(NetworkObject), "Despawn")]
		public static bool DespawnPrefix(NetworkObject __instance)
		{
			try
			{
				if (!despawningProps)
				{
					return true;
				}
				if (StartOfRound.Instance.firingPlayersCutsceneRunning)
				{
					return true;
				}
				GrabbableObject val = default(GrabbableObject);
				if (!((Component)__instance).TryGetComponent<GrabbableObject>(ref val))
				{
					return true;
				}
				if (teamWipeBlacklist.Contains(((Object)val.itemProperties).name))
				{
					return true;
				}
				if (StartOfRound.Instance.isChallengeFile || (!val.isHeld && !val.isInShipRoom) || val.deactivated)
				{
					return true;
				}
				if (val.scrapValue > 0)
				{
					return true;
				}
				return false;
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)ex);
				return true;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
		public static void DespawnPropsAtEndOfRoundPrefix(RoundManager __instance)
		{
			try
			{
				despawningProps = Configs.PreventDespawnOnTeamWipe;
				if (despawningProps)
				{
					teamWipeBlacklist = Configs.TeamWipeBlacklist.Replace(" ", "").Split(",");
				}
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)ex);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
		public static void DespawnPropsAtEndOfRoundPostfix(RoundManager __instance)
		{
			despawningProps = false;
		}
	}
	[BepInPlugin("Snowlance.LethalWashing", "LethalWashing", "1.4.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("Snowlance.LethalWashing");

		public static Plugin Instance { get; private set; }

		public static ManualLogSource logger { get; private set; }

		public static DuskMod Mod { get; private set; }

		public static PlayerControllerB localPlayer => GameNetworkManager.Instance.localPlayerController;

		public static bool IsServerOrHost => NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost;

		public static PlayerControllerB PlayerFromId(ulong id)
		{
			return StartOfRound.Instance.allPlayerScripts[StartOfRound.Instance.ClientPlayerList[id]];
		}

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = ((BaseUnityPlugin)Instance).Logger;
			harmony.PatchAll();
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "lethalwashing_mainassets"));
			Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			Mod.RegisterContentHandlers();
			InitializeNetworkBehaviours();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.LethalWashing v1.4.0 has loaded!");
		}

		private static void InitializeNetworkBehaviours()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			logger.LogDebug((object)"Finished initializing network behaviours");
		}
	}
	[HarmonyPatch]
	public class TESTING : MonoBehaviour
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		public static void PingScan_performedPostFix()
		{
			try
			{
				if (Utils.testing)
				{
				}
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)ex);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			try
			{
				string text = __instance.chatTextField.text;
				string[] array = text.Split(" ");
				string text2 = array[0];
				string text3 = text2;
				if (text3 == "/lw_items")
				{
					{
						foreach (DawnItemInfo value in ((Registry<DawnItemInfo>)(object)LethalContent.Items).Values)
						{
							Plugin.logger.LogInfo((object)((Object)value.Item).name);
						}
						return;
					}
				}
				if (Utils.testing && Plugin.IsServerOrHost)
				{
					Utils.ChatCommand(array);
				}
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)ex);
			}
		}
	}
	internal class WashingMachine : NetworkBehaviour
	{
		public Animator animator;

		public Animator coinSpawnAnimator;

		public Transform coinSpawn;

		public Transform drumPosition;

		public InteractTrigger drumTrigger;

		public InteractTrigger doorTrigger;

		public AudioSource audioSource;

		public AudioClip dingSFX;

		public AudioClip doorOpenSFX;

		public AudioClip doorCloseSFX;

		public Collider drumCollider;

		public Collider doorCollider;

		public PlaceableShipObject placeableShipObject;

		public InteractTrigger resetTrigger;

		public InteractTrigger hardResetTrigger;

		public List<GrabbableObject> itemsInDrum = new List<GrabbableObject>();

		private float washTimer;

		private bool readyForNextWash;

		private bool doorOpen;

		private bool closedUntilCompanyDay = true;

		private Vector3 initialCoinSpawnPosition;

		private bool spawningCoins;

		private List<int> coinsToSpawn = new List<int>();

		private string[] blacklist = Array.Empty<string>();

		public static WashingMachine? Instance { get; private set; }

		private bool localPlayerHoldingScrap => Plugin.localPlayer.isHoldingObject && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null && Plugin.localPlayer.currentlyHeldObjectServer.itemProperties.isScrap;

		private bool washing => washTimer > 0f;

		private bool usable => TimeOfDay.Instance.daysUntilDeadline <= 0 || !Configs.UsableOnlyOnCompanyDay;

		public void Start()
		{
			//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_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			blacklist = Configs.Blacklist.Replace(" ", "").Split(",");
			initialCoinSpawnPosition = coinSpawn.position;
			Plugin.logger.LogDebug((object)("Washing Machine spawned at " + ((object)((Component)this).transform.position/*cast due to .constrained prefix*/).ToString()));
		}

		public override void OnDestroy()
		{
			Instance = null;
		}

		public void Update()
		{
			resetTrigger.interactable = (Plugin.localPlayer.isHostPlayerObject ? true : false);
			hardResetTrigger.interactable = (Plugin.localPlayer.isHostPlayerObject ? true : false);
			if (coinsToSpawn.Count > 0 && !spawningCoins)
			{
				spawningCoins = true;
				animator.SetBool("hatchOpen", true);
			}
			if (washTimer > 0f)
			{
				washTimer -= Time.deltaTime;
				if (washTimer <= 0f)
				{
					FinishWashScrap();
				}
			}
			doorCollider.enabled = !washing && doorOpen && itemsInDrum.Count > 0 && readyForNextWash && usable && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer == (Object)null;
			drumCollider.enabled = !washing && readyForNextWash && (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null;
			drumTrigger.interactable = !washing && doorOpen && readyForNextWash && usable && localPlayerHoldingScrap && !blacklist.Contains(((Object)Plugin.localPlayer.currentlyHeldObjectServer.itemProperties).name);
			foreach (GrabbableObject item in itemsInDrum.ToList())
			{
				if ((Object)(object)item == (Object)null || item.isHeld || (Object)(object)item.playerHeldBy != (Object)null)
				{
					itemsInDrum.Remove(item);
				}
			}
			if (!readyForNextWash && itemsInDrum.Count <= 0)
			{
				readyForNextWash = true;
			}
			if (!usable)
			{
				if (itemsInDrum.Count <= 0 && doorOpen)
				{
					OpenDoor(open: false);
					closedUntilCompanyDay = true;
				}
				drumTrigger.disabledHoverTip = "No washing until company day";
			}
			if (usable && closedUntilCompanyDay)
			{
				closedUntilCompanyDay = false;
				OpenDoor(open: true);
			}
			if (!washing)
			{
				if (!((Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null))
				{
					return;
				}
				if (localPlayerHoldingScrap)
				{
					if (blacklist.Contains(((Object)Plugin.localPlayer.currentlyHeldObjectServer.itemProperties).name))
					{
						drumTrigger.disabledHoverTip = "Blacklisted! Item not allowed!";
					}
					else
					{
						drumTrigger.hoverTip = "Add scrap [E]";
					}
				}
				else
				{
					drumTrigger.disabledHoverTip = "Requires scrap";
				}
			}
			else
			{
				drumTrigger.disabledHoverTip = "Washing scrap - " + (int)washTimer;
			}
		}

		public void OpenDoor(bool open)
		{
			animator.SetBool("doorOpen", open);
			doorOpen = open;
		}

		public void FinishWashScrap()
		{
			if (itemsInDrum.Count == 0)
			{
				return;
			}
			OpenDoor(open: true);
			List<int> list = new List<int>();
			foreach (GrabbableObject item in itemsInDrum)
			{
				if (item.scrapValue > 0)
				{
					list.Add(item.scrapValue);
					item.SetScrapValue(0);
				}
				ScanNodeProperties componentInChildren = ((Component)item).gameObject.GetComponentInChildren<ScanNodeProperties>();
				if ((Object)(object)componentInChildren != (Object)null)
				{
					componentInChildren.subText = "";
				}
				else
				{
					Plugin.logger.LogWarning((object)("Cant find scannode for " + ((Object)item.itemProperties).name));
				}
				item.grabbable = true;
			}
			if (list.Count == 0)
			{
				Plugin.logger.LogDebug((object)"No scrap values");
			}
			else
			{
				SpawnCoins(list);
			}
		}

		private void SpawnCoins(List<int> values)
		{
			if (!((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			if (Configs.CombineCoinValues && Configs.CoinsToSpawn > 0)
			{
				int num = values.Sum();
				if (num > 0)
				{
					values.Clear();
					int num2 = num / Configs.CoinsToSpawn;
					int num3 = num % Configs.CoinsToSpawn;
					for (int i = 0; i < Configs.CoinsToSpawn; i++)
					{
						values.Add(num2 + ((i < num3) ? 1 : 0));
					}
				}
			}
			SpawnCoinsClientRpc(values.ToArray());
		}

		public void StartWash()
		{
			WashScrapServerRpc();
		}

		public void AddScrapToWasher()
		{
			//IL_0045: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			GrabbableObject currentlyHeldObjectServer = Plugin.localPlayer.currentlyHeldObjectServer;
			if (localPlayerHoldingScrap && !Plugin.localPlayer.isGrabbingObjectAnimation)
			{
				Plugin.localPlayer.DiscardHeldObject(true, ((NetworkBehaviour)this).NetworkObject, ((Component)((NetworkBehaviour)this).NetworkObject).transform.InverseTransformPoint(drumPosition.position), false);
				if (!((Object)(object)currentlyHeldObjectServer == (Object)null) && ((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject.IsSpawned)
				{
					AddItemToDrumServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)currentlyHeldObjectServer).NetworkObject));
				}
			}
		}

		public void ResetWasher()
		{
			ResetWasherServerRpc();
		}

		public void HardResetWasher()
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				ResetWasher();
			}
			catch (Exception ex)
			{
				Plugin.logger.LogError((object)ex);
			}
			finally
			{
				Plugin.logger.LogDebug((object)"Hard resetting");
				ShipBuildModeManager.Instance.StoreObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)this).NetworkObject), (int)Plugin.localPlayer.playerClientId);
			}
		}

		public void PlayDoorSFX()
		{
			if (usable)
			{
				if (washing)
				{
					audioSource.PlayOneShot(doorCloseSFX);
					audioSource.Play();
					readyForNextWash = false;
				}
				else
				{
					audioSource.Stop();
					audioSource.PlayOneShot(dingSFX);
					audioSource.PlayOneShot(doorOpenSFX);
				}
			}
		}

		public void CoinFinishEjecting()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			int scrapValueClientRpc = coinsToSpawn.First();
			coinsToSpawn.RemoveAt(0);
			Vector3 val = coinSpawn.position + coinSpawn.forward * 0.764f + coinSpawn.up * 0.645f;
			CoinBehavior coinBehavior = (CoinBehavior)(object)Utils.SpawnItem(LethalWashingKeys.Coin, val, ((Component)coinSpawn).transform.rotation, (Transform)null, 0f, true);
			if ((Object)(object)coinBehavior != (Object)null)
			{
				coinBehavior.SetScrapValueClientRpc(scrapValueClientRpc);
			}
			if (coinsToSpawn.Count <= 0)
			{
				spawningCoins = false;
				animator.SetBool("hatchOpen", false);
			}
			else
			{
				((Component)coinSpawn).transform.position = initialCoinSpawnPosition + new Vector3(Random.Range(-0.5f, 0.5f), 0f, Random.Range(-0.5f, 0.5f));
				coinSpawnAnimator.SetTrigger("spawn");
			}
		}

		public void OnHatchOpen()
		{
			Plugin.logger.LogDebug((object)"OnHatchOpen");
			if (coinsToSpawn.Count > 0)
			{
				coinSpawnAnimator.SetTrigger("spawn");
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ResetWasherServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3674847680u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 3674847680u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (((NetworkBehaviour)this).IsServer)
				{
					ResetWasherClientRpc();
				}
			}
		}

		[ClientRpc]
		public void ResetWasherClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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_0135: 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_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1380578081u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1380578081u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			Plugin.logger.LogDebug((object)"Resetting washer...");
			foreach (GrabbableObject item in itemsInDrum)
			{
				item.parentObject = null;
				((Component)item).transform.SetParent(StartOfRound.Instance.propsContainer, true);
				item.EnablePhysics(true);
				item.fallTime = 0f;
				item.startFallingPosition = ((Component)item).transform.parent.InverseTransformPoint(((Component)item).transform.position);
				item.targetFloorPosition = ((Component)item).transform.parent.InverseTransformPoint(item.GetItemFloorPosition(item.startFallingPosition));
				item.hasHitGround = false;
				item.FallToGround(false, false, default(Vector3));
			}
			itemsInDrum.Clear();
		}

		[ClientRpc]
		public void SpawnCoinsClientRpc(int[] values)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1130556806u, val2, (RpcDelivery)0);
				bool flag = values != null;
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val)).WriteValueSafe<int>(values, default(ForPrimitives));
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1130556806u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				coinsToSpawn.AddRange(values);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void AddItemToDrumServerRpc(NetworkObjectReference netRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(870401845u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 870401845u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (((NetworkBehaviour)this).IsServer)
				{
					AddItemToDrumClientRpc(netRef);
				}
			}
		}

		[ClientRpc]
		public void AddItemToDrumClientRpc(NetworkObjectReference netRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4118516000u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 4118516000u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				NetworkObject val3 = default(NetworkObject);
				GrabbableObject item = default(GrabbableObject);
				if (((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<GrabbableObject>(ref item))
				{
					itemsInDrum.Add(item);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void WashScrapServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2818544261u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2818544261u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (((NetworkBehaviour)this).IsServer)
				{
					WashScrapClientRpc();
				}
			}
		}

		[ClientRpc]
		public void WashScrapClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(273201484u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 273201484u, val2, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			base.__rpc_exec_stage = (__RpcExecStage)0;
			foreach (GrabbableObject item in itemsInDrum)
			{
				item.grabbable = false;
			}
			OpenDoor(open: false);
			washTimer = Configs.WashTime;
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(3674847680u, new RpcReceiveHandler(__rpc_handler_3674847680), "ResetWasherServerRpc");
			((NetworkBehaviour)this).__registerRpc(1380578081u, new RpcReceiveHandler(__rpc_handler_1380578081), "ResetWasherClientRpc");
			((NetworkBehaviour)this).__registerRpc(1130556806u, new RpcReceiveHandler(__rpc_handler_1130556806), "SpawnCoinsClientRpc");
			((NetworkBehaviour)this).__registerRpc(870401845u, new RpcReceiveHandler(__rpc_handler_870401845), "AddItemToDrumServerRpc");
			((NetworkBehaviour)this).__registerRpc(4118516000u, new RpcReceiveHandler(__rpc_handler_4118516000), "AddItemToDrumClientRpc");
			((NetworkBehaviour)this).__registerRpc(2818544261u, new RpcReceiveHandler(__rpc_handler_2818544261), "WashScrapServerRpc");
			((NetworkBehaviour)this).__registerRpc(273201484u, new RpcReceiveHandler(__rpc_handler_273201484), "WashScrapClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_3674847680(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WashingMachine)(object)target).ResetWasherServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1380578081(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WashingMachine)(object)target).ResetWasherClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1130556806(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: 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_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool flag = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
				int[] values = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref values, default(ForPrimitives));
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WashingMachine)(object)target).SpawnCoinsClientRpc(values);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_870401845(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WashingMachine)(object)target).AddItemToDrumServerRpc(netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4118516000(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WashingMachine)(object)target).AddItemToDrumClientRpc(netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2818544261(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WashingMachine)(object)target).WashScrapServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_273201484(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((WashingMachine)(object)target).WashScrapClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "WashingMachine";
		}
	}
	internal class WashingMachineCoinSpawn : MonoBehaviour
	{
		[SerializeField]
		private WashingMachine mainScript = null;

		public void CoinFinishEjectingAnimation()
		{
			mainScript.CoinFinishEjecting();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Snowlance.LethalWashing";

		public const string PLUGIN_NAME = "LethalWashing";

		public const string PLUGIN_VERSION = "1.4.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace Snowlance.LethalWashing.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}