Decompiled source of LethalWashing v1.0.1

LethalWashing/Snowlance.LethalWashing.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Snowlance.LethalWashing.NetcodePatcher;
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("DissonanceVoip")]
[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.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("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("Snowlance.LethalWashing")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+b7c0f0db334d2d029b8bbe57861632aa181c7f6f")]
[assembly: AssemblyProduct("LethalWashing")]
[assembly: AssemblyTitle("Snowlance.LethalWashing")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 LethalWashing
{
	internal class NoDespawnScript : MonoBehaviour
	{
	}
	[HarmonyPatch]
	internal class Patches
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

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

		[HarmonyPostfix]
		[HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")]
		public static void DespawnPropsAtEndOfRoundPatch(RoundManager __instance)
		{
			try
			{
				if (Plugin.IsServerOrHost && __instance.currentLevel.levelID == 3 && !((Object)(object)WashingMachine.Instance == (Object)null))
				{
					((NetworkBehaviour)WashingMachine.Instance).NetworkObject.Despawn(true);
				}
			}
			catch (Exception ex)
			{
				logger.LogError((object)ex);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(RoundManager), "LoadNewLevelWait")]
		public static void LoadNewLevelWaitPrefix(RoundManager __instance)
		{
			//IL_003d: 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)
			try
			{
				if (Plugin.IsServerOrHost && __instance.currentLevel.levelID == 3)
				{
					Object.Instantiate<GameObject>(Plugin.PluginInstance.WashingMachineRef.spawnableMapObject.prefabToSpawn, WashingMachine.worldPosition, WashingMachine.worldRotation).GetComponent<NetworkObject>().Spawn(true);
				}
			}
			catch (Exception ex)
			{
				logger.LogError((object)ex);
			}
		}
	}
	internal class TESTING : MonoBehaviour
	{
		private static ManualLogSource logger = Plugin.LoggerInstance;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(HUDManager), "PingScan_performed")]
		public static void PingScan_performedPostFix()
		{
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
		public static void SubmitChat_performedPrefix(HUDManager __instance)
		{
			//IL_005a: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			//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)
			string text = __instance.chatTextField.text;
			string[] array = text.Split(" ");
			string text2 = array[0];
			string text3 = text2;
			if (!(text3 == "/spawn"))
			{
				if (text3 == "/refresh")
				{
					RoundManager.Instance.RefreshEnemiesList();
					HoarderBugAI.RefreshGrabbableObjectsInMapList();
				}
			}
			else
			{
				Object.Instantiate<GameObject>(Plugin.PluginInstance.WashingMachineRef.spawnableMapObject.prefabToSpawn, ((Component)Plugin.localPlayer).transform.position + ((Component)Plugin.localPlayer).transform.forward * 2f, Quaternion.identity).GetComponent<NetworkObject>().Spawn(true);
			}
		}
	}
	[BepInPlugin("Snowlance.LethalWashing", "LethalWashing", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin PluginInstance;

		public static ManualLogSource LoggerInstance;

		private readonly Harmony harmony = new Harmony("Snowlance.LethalWashing");

		public SpawnableMapObjectDef WashingMachineRef = null;

		public static AssetBundle ModAssets;

		public static ConfigEntry<float> configWashTime;

		public static ConfigEntry<Vector3> configWorldPosition;

		public static ConfigEntry<Quaternion> configWorldRotation;

		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()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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)
			if ((Object)(object)PluginInstance == (Object)null)
			{
				PluginInstance = this;
			}
			LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger;
			harmony.PatchAll();
			InitializeNetworkBehaviours();
			configWashTime = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Wash Time", 10f, "Time it takes for the washing machine to finish washing scrap.");
			configWorldPosition = ((BaseUnityPlugin)this).Config.Bind<Vector3>("General", "World Position", new Vector3(-27.6681f, -2.5747f, -24.764f), "The world spawn position of the washing machine at the company. By default it spawns next to the sell counter.");
			configWorldRotation = ((BaseUnityPlugin)this).Config.Bind<Quaternion>("General", "World Rotation", Quaternion.Euler(0f, 90f, 0f), "The world spawn rotation of the washing machine at the company.");
			WashingMachine.worldPosition = configWorldPosition.Value;
			WashingMachine.worldRotation = configWorldRotation.Value;
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "washing_assets"));
			if ((Object)(object)ModAssets == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets.");
				return;
			}
			LoggerInstance.LogDebug((object)("Got AssetBundle at: " + Path.Combine(directoryName, "washing_assets")));
			WashingMachineRef = ModAssets.LoadAsset<SpawnableMapObjectDef>("Assets/ModAssets/WashingMachine.asset");
			if ((Object)(object)WashingMachineRef == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get WashingMachine from assets");
				return;
			}
			LoggerInstance.LogDebug((object)"Registering WashingMachine network prefab...");
			NetworkPrefabs.RegisterNetworkPrefab(WashingMachineRef.spawnableMapObject.prefabToSpawn);
			Utilities.FixMixerGroups(WashingMachineRef.spawnableMapObject.prefabToSpawn);
			LoggerInstance.LogDebug((object)"Registering WashingMachine");
			MapObjects.RegisterMapObject(WashingMachineRef, (LevelTypes)1, (string[])null, (Func<SelectableLevel, AnimationCurve>)null);
			Item val = ModAssets.LoadAsset<Item>("Assets/ModAssets/CoinItem.asset");
			if ((Object)(object)val == (Object)null)
			{
				LoggerInstance.LogError((object)"Error: Couldnt get CoinItem from assets");
				return;
			}
			LoggerInstance.LogDebug((object)"Got Coin prefab");
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Utilities.FixMixerGroups(val.spawnPrefab);
			Items.RegisterScrap(val, (Dictionary<LevelTypes, int>)null, (Dictionary<string, int>)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Snowlance.LethalWashing v1.0.1 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);
					}
				}
			}
			LoggerInstance.LogDebug((object)"Finished initializing network behaviours");
		}
	}
	public class WashingMachine : NetworkBehaviour
	{
		public static WashingMachine? Instance;

		public GameObject CoinPrefab = null;

		public Animator animator = null;

		public Transform CoinSpawn = null;

		public InteractTrigger trigger = null;

		public AudioSource WashingMachineAudio = null;

		public AudioClip DingSFX = null;

		public AudioClip DoorOpenSFX = null;

		public AudioClip DoorCloseSFX = null;

		public Transform DrumPosition = null;

		public Collider triggerCollider = null;

		private GrabbableObject? itemInDrum;

		private GrabbableObject? coinInHatch;

		private bool washing;

		private float washTimer;

		private bool canWashScrap;

		private float washTime = 10f;

		public static Vector3 worldPosition = new Vector3(-27.6681f, -2.5747f, -24.764f);

		public static Quaternion worldRotation = Quaternion.Euler(0f, 90f, 0f);

		private bool LocalPlayerHoldingScrap => (Object)(object)Plugin.localPlayer.currentlyHeldObjectServer != (Object)null && Plugin.localPlayer.currentlyHeldObjectServer.itemProperties.isScrap && (Object)(object)((Component)Plugin.localPlayer.currentlyHeldObjectServer).GetComponent<NoDespawnScript>() == (Object)null;

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if ((Object)(object)Instance != (Object)null)
			{
				((NetworkBehaviour)Instance).NetworkObject.Despawn(true);
			}
			Instance = this;
		}

		public override void OnNetworkDespawn()
		{
			((NetworkBehaviour)this).OnNetworkDespawn();
			Instance = null;
		}

		public void Start()
		{
			washTime = Plugin.configWashTime.Value;
			Plugin.LoggerInstance.LogDebug((object)"Washing machine spawned");
		}

		public void Update()
		{
			if (washTimer > 0f)
			{
				washTimer -= Time.deltaTime;
				if (washTimer <= 0f)
				{
					FinishWashScrap();
				}
			}
			if ((Object)(object)coinInHatch != (Object)null && (Object)(object)coinInHatch.playerHeldBy != (Object)null)
			{
				coinInHatch = null;
				animator.SetBool("hatchOpen", false);
			}
			if ((Object)(object)itemInDrum != (Object)null && (Object)(object)itemInDrum.playerHeldBy != (Object)null)
			{
				itemInDrum = null;
			}
			if (!washing && (Object)(object)itemInDrum == (Object)null)
			{
				triggerCollider.enabled = true;
				if (LocalPlayerHoldingScrap)
				{
					if ((Object)(object)coinInHatch != (Object)null)
					{
						trigger.interactable = false;
						trigger.disabledHoverTip = "Take coin from hatch";
						canWashScrap = false;
					}
					else
					{
						trigger.interactable = true;
						trigger.hoverTip = "Wash Scrap [E]";
						canWashScrap = true;
					}
				}
				else
				{
					trigger.interactable = false;
					trigger.disabledHoverTip = "Requires scrap";
					canWashScrap = false;
				}
			}
			else if ((Object)(object)itemInDrum != (Object)null && washing)
			{
				triggerCollider.enabled = true;
				trigger.interactable = false;
				trigger.disabledHoverTip = "Washing scrap - " + (int)washTimer;
				canWashScrap = false;
			}
			else if ((Object)(object)itemInDrum != (Object)null && !washing)
			{
				triggerCollider.enabled = false;
				trigger.interactable = false;
				trigger.disabledHoverTip = "";
				canWashScrap = false;
			}
		}

		public void FinishWashScrap()
		{
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)itemInDrum == (Object)null)
			{
				Plugin.LoggerInstance.LogError((object)"Item in washing machine is null!");
				return;
			}
			washing = false;
			animator.SetBool("doorOpen", true);
			int scrapValue = itemInDrum.scrapValue;
			itemInDrum.SetScrapValue(0);
			((Component)itemInDrum).gameObject.AddComponent<NoDespawnScript>();
			ScanNodeProperties componentInChildren = ((Component)itemInDrum).gameObject.GetComponentInChildren<ScanNodeProperties>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.subText = "";
			}
			else
			{
				Plugin.LoggerInstance.LogError((object)("Scan node is missing for item!: " + ((Object)((Component)itemInDrum).gameObject).name));
			}
			itemInDrum.grabbable = true;
			WashingMachineAudio.PlayOneShot(DingSFX, 1f);
			if (Plugin.IsServerOrHost && scrapValue > 0)
			{
				coinInHatch = (GrabbableObject?)(object)Object.Instantiate<GameObject>(CoinPrefab, CoinSpawn).GetComponentInChildren<PhysicsProp>();
				((NetworkBehaviour)coinInHatch).NetworkObject.Spawn(true);
				SpawnCoinInHatchClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)coinInHatch).NetworkObject), scrapValue);
			}
		}

		public void WashScrap()
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if (LocalPlayerHoldingScrap && !washing && (Object)(object)itemInDrum == (Object)null && (Object)(object)coinInHatch == (Object)null)
			{
				washing = true;
				itemInDrum = Plugin.localPlayer.currentlyHeldObjectServer;
				Plugin.localPlayer.DiscardHeldObject(true, (NetworkObject)null, DrumPosition.position, true);
				WashScrapServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)itemInDrum).NetworkObject));
			}
		}

		public void PlayDoorSFX()
		{
			if (washing)
			{
				WashingMachineAudio.PlayOneShot(DoorCloseSFX);
				WashingMachineAudio.Play();
				washTimer = washTime;
			}
			else
			{
				WashingMachineAudio.Stop();
				WashingMachineAudio.PlayOneShot(DingSFX);
				WashingMachineAudio.PlayOneShot(DoorOpenSFX);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void WashScrapServerRpc(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_00e2: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2855618346u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2855618346u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && Plugin.IsServerOrHost)
				{
					WashScrapClientRpc(netRef);
				}
			}
		}

		[ClientRpc]
		public void WashScrapClientRpc(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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(107728384u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 107728384u, val, (RpcDelivery)0);
				}
				NetworkObject val3 = default(NetworkObject);
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null))
				{
					itemInDrum = ((Component)val3).GetComponent<GrabbableObject>();
					itemInDrum.grabbable = false;
					washing = true;
					animator.SetBool("doorOpen", false);
				}
			}
		}

		[ClientRpc]
		public void SpawnCoinInHatchClientRpc(NetworkObjectReference netRef, int coinValue)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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_008c: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2767449914u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, coinValue);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2767449914u, val, (RpcDelivery)0);
			}
			NetworkObject val3 = default(NetworkObject);
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref netRef)).TryGet(ref val3, (NetworkManager)null))
			{
				coinInHatch = (GrabbableObject?)(object)((Component)val3).GetComponent<PhysicsProp>();
				if ((Object)(object)coinInHatch == (Object)null)
				{
					Plugin.LoggerInstance.LogError((object)"Coin in hatch is null!");
					return;
				}
				coinInHatch.fallTime = 1f;
				coinInHatch.SetScrapValue(coinValue);
				animator.SetBool("hatchOpen", true);
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_WashingMachine()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2855618346u, new RpcReceiveHandler(__rpc_handler_2855618346));
			NetworkManager.__rpc_func_table.Add(107728384u, new RpcReceiveHandler(__rpc_handler_107728384));
			NetworkManager.__rpc_func_table.Add(2767449914u, new RpcReceiveHandler(__rpc_handler_2767449914));
		}

		private static void __rpc_handler_2855618346(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).WashScrapServerRpc(netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_107728384(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)2;
				((WashingMachine)(object)target).WashScrapClientRpc(netRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2767449914(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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: 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));
				int coinValue = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref coinValue);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((WashingMachine)(object)target).SpawnCoinInHatchClientRpc(netRef, coinValue);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "WashingMachine";
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Snowlance.LethalWashing";

		public const string PLUGIN_NAME = "LethalWashing";

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