Decompiled source of VileVendingMachine v1.1.2

Vending Machine/LethalCompanyVileVendingMachine.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyVileVendingMachine.NetcodePatcher;
using LethalLib.Modules;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.VFX;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("LethalLib")]
[assembly: AssemblyCompany("Louis")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Lethal Company Vile Vending Machine")]
[assembly: AssemblyFileVersion("1.1.2.0")]
[assembly: AssemblyInformationalVersion("1.1.2+4b2987d1df50100b9714cee9183f8525111c0d65")]
[assembly: AssemblyProduct("LethalCompanyVileVendingMachine")]
[assembly: AssemblyTitle("LethalCompanyVileVendingMachine")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.2.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
		NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
		NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 LethalCompanyVileVendingMachine
{
	[BepInPlugin("LethalCompanyVileVendingMachine", "LethalCompanyVileVendingMachine", "1.1.2")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class VileVendingMachinePlugin : BaseUnityPlugin
	{
		public const string ModGuid = "LCM_VileVendingMachine|1.1.2";

		private const string ModName = "Lethal Company Vile Vending Machine Mod";

		private const string ModVersion = "1.1.2";

		private readonly Harmony _harmony = new Harmony("LCM_VileVendingMachine|1.1.2");

		public static readonly ManualLogSource Mls = Logger.CreateLogSource("LCM_VileVendingMachine|1.1.2");

		private static VileVendingMachinePlugin _instance;

		private static EnemyType _vileVendingMachineEnemyType;

		public static Item CompanyColaItem;

		public static Item CrushedCompanyColaItem;

		private static Item _plushieItem;

		public static VileVendingMachineConfig VileVendingMachineConfigInstance { get; internal set; }

		private void Awake()
		{
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = this;
			}
			if (LobbyCompatibilityChecker.Enabled)
			{
				LobbyCompatibilityChecker.Init();
			}
			InitializeNetworkStuff();
			Assets.PopulateAssetsFromFile();
			if ((Object)(object)Assets.MainAssetBundle == (Object)null)
			{
				Mls.LogError((object)"MainAssetBundle is null");
				return;
			}
			_harmony.PatchAll();
			VileVendingMachineConfigInstance = new VileVendingMachineConfig(((BaseUnityPlugin)this).Config);
			SetupVileVendingMachine();
			SetupCompanyCola();
			SetupCrushedCompanyCola();
			SetupPlushie();
			_harmony.PatchAll(typeof(VendingMachineRegistry));
			_harmony.PatchAll(typeof(VileVendingMachinePlugin));
			_harmony.PatchAll(typeof(CompanyColaBehaviour));
			Mls.LogInfo((object)"Plugin Lethal Company Vile Vending Machine Mod is loaded!");
		}

		private void SetupVileVendingMachine()
		{
			_vileVendingMachineEnemyType = Assets.MainAssetBundle.LoadAsset<EnemyType>("VileVendingMachine");
			_vileVendingMachineEnemyType.MaxCount = SyncedInstance<VileVendingMachineConfig>.Instance.MaxAmount.Value;
			TerminalNode terminalNode = Assets.MainAssetBundle.LoadAsset<TerminalNode>("VileVendingMachineTN");
			TerminalKeyword terminalKeyword = Assets.MainAssetBundle.LoadAsset<TerminalKeyword>("VileVendingMachineTK");
			NetworkPrefabs.RegisterNetworkPrefab(_vileVendingMachineEnemyType.enemyPrefab);
			Utilities.FixMixerGroups(_vileVendingMachineEnemyType.enemyPrefab);
			RegisterEnemyWithConfig(SyncedInstance<VileVendingMachineConfig>.Instance.VendingMachineEnabled.Value, SyncedInstance<VileVendingMachineConfig>.Instance.VendingMachineSpawnRarity.Value, _vileVendingMachineEnemyType, terminalNode, terminalKeyword);
		}

		private void SetupCompanyCola()
		{
			CompanyColaItem = Assets.MainAssetBundle.LoadAsset<Item>("CompanyColaItemData");
			if ((Object)(object)CompanyColaItem == (Object)null)
			{
				Mls.LogError((object)"Failed to load CompanyColaItemData from AssetBundle");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(CompanyColaItem.spawnPrefab);
			Utilities.FixMixerGroups(CompanyColaItem.spawnPrefab);
			Items.RegisterScrap(CompanyColaItem, 0, (LevelTypes)(-1));
		}

		private void SetupCrushedCompanyCola()
		{
			CrushedCompanyColaItem = Assets.MainAssetBundle.LoadAsset<Item>("CrushedCompanyColaItemData");
			if ((Object)(object)CrushedCompanyColaItem == (Object)null)
			{
				Mls.LogError((object)"Failed to load CrushedCompanyColaItemData from AssetBundle");
				return;
			}
			NetworkPrefabs.RegisterNetworkPrefab(CrushedCompanyColaItem.spawnPrefab);
			Utilities.FixMixerGroups(CrushedCompanyColaItem.spawnPrefab);
			Items.RegisterScrap(CrushedCompanyColaItem, 0, (LevelTypes)(-1));
		}

		private void SetupPlushie()
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			_plushieItem = Assets.MainAssetBundle.LoadAsset<Item>("VileVendingMachinePlushieItemData");
			if ((Object)(object)_plushieItem == (Object)null)
			{
				Mls.LogError((object)"Failed to load VileVendingMachinePlushieItemData from AssetBundle");
				return;
			}
			_plushieItem.minValue = Mathf.Clamp(SyncedInstance<VileVendingMachineConfig>.Instance.PlushieMinValue.Value, 0, int.MaxValue);
			_plushieItem.maxValue = Mathf.Clamp(SyncedInstance<VileVendingMachineConfig>.Instance.PlushieMaxValue.Value, 0, int.MaxValue);
			NetworkPrefabs.RegisterNetworkPrefab(_plushieItem.spawnPrefab);
			Utilities.FixMixerGroups(_plushieItem.spawnPrefab);
			Items.RegisterScrap(_plushieItem, Mathf.Clamp(SyncedInstance<VileVendingMachineConfig>.Instance.PlushieSpawnRate.Value, 0, int.MaxValue), SyncedInstance<VileVendingMachineConfig>.Instance.PlushieSpawnLevel.Value);
		}

		private static void InitializeNetworkStuff()
		{
			IEnumerable<Type> enumerable;
			try
			{
				enumerable = Assembly.GetExecutingAssembly().GetTypes();
			}
			catch (ReflectionTypeLoadException ex)
			{
				enumerable = ex.Types.Where((Type t) => t != null);
			}
			foreach (Type item in enumerable)
			{
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		private static void RegisterEnemyWithConfig(bool enemyEnabled, string configMoonRarity, EnemyType enemy, TerminalNode terminalNode, TerminalKeyword terminalKeyword)
		{
			if (enemyEnabled)
			{
				var (dictionary, dictionary2) = ConfigParsing(configMoonRarity);
				Enemies.RegisterEnemy(enemy, dictionary, dictionary2, terminalNode, terminalKeyword);
			}
			else
			{
				Enemies.RegisterEnemy(enemy, 0, (LevelTypes)(-1), terminalNode, terminalKeyword);
			}
		}

		private static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) ConfigParsing(string configMoonRarity)
		{
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>();
			Dictionary<string, int> dictionary2 = new Dictionary<string, int>();
			foreach (string item in from s in configMoonRarity.Split(',')
				select s.Trim())
			{
				string[] array = item.Split(':');
				if (array.Length != 2)
				{
					continue;
				}
				string text = array[0];
				if (int.TryParse(array[1], out var result))
				{
					if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2))
					{
						dictionary[result2] = result;
						Mls.LogDebug((object)$"Registered spawn rate for level type {result2} to {result}");
					}
					else if (Enum.TryParse<LevelTypes>(text + "Level", ignoreCase: true, out result2))
					{
						dictionary[result2] = result;
						Mls.LogDebug((object)$"Registered spawn rate for level type {result2} to {result}");
					}
					else
					{
						dictionary2[text] = result;
						Mls.LogDebug((object)$"Registered spawn rate for custom level type {text} to {result}");
					}
				}
			}
			return (dictionary, dictionary2);
		}
	}
	[Serializable]
	public class SyncedInstance<T>
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static HandleNamedMessageDelegate <0>__OnRequestSync;

			public static HandleNamedMessageDelegate <1>__OnReceiveSync;
		}

		[NonSerialized]
		protected static int IntSize = 4;

		internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;

		internal static bool IsClient => NetworkManager.Singleton.IsClient;

		internal static bool IsHost => NetworkManager.Singleton.IsHost;

		public static T Default { get; private set; }

		public static T Instance { get; private set; }

		public static bool Synced { get; internal set; }

		protected void InitInstance(T instance)
		{
			Default = instance;
			Instance = instance;
			IntSize = 4;
		}

		internal static void SyncInstance(byte[] data)
		{
			Instance = DeserializeFromBytes(data);
			Synced = true;
		}

		internal static void RevertSync()
		{
			Instance = Default;
			Synced = false;
		}

		public static byte[] SerializeToBytes(T val)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream memoryStream = new MemoryStream();
			try
			{
				binaryFormatter.Serialize(memoryStream, val);
				return memoryStream.ToArray();
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error serializing instance: {arg}");
				return null;
			}
		}

		public static T DeserializeFromBytes(byte[] data)
		{
			BinaryFormatter binaryFormatter = new BinaryFormatter();
			using MemoryStream serializationStream = new MemoryStream(data);
			try
			{
				return (T)binaryFormatter.Deserialize(serializationStream);
			}
			catch (Exception arg)
			{
				Debug.LogError((object)$"Error deserializing instance: {arg}");
				return default(T);
			}
		}

		private static void RequestSync()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			if (!IsClient)
			{
				return;
			}
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(IntSize, (Allocator)2, -1);
			try
			{
				MessageManager.SendNamedMessage("LCM_VileVendingMachine|1.1.2_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnRequestSync(ulong clientId, FastBufferReader _)
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (!IsHost)
			{
				return;
			}
			Debug.Log((object)$"Config sync request received from client: {clientId}");
			byte[] array = SerializeToBytes(Instance);
			int num = array.Length;
			FastBufferWriter val = default(FastBufferWriter);
			((FastBufferWriter)(ref val))..ctor(num + IntSize, (Allocator)2, -1);
			try
			{
				((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
				MessageManager.SendNamedMessage("LCM_VileVendingMachine|1.1.2_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
			}
			catch (Exception arg)
			{
				Debug.Log((object)$"Error occurred syncing config with client: {clientId}\n{arg}");
			}
			finally
			{
				((IDisposable)(FastBufferWriter)(ref val)).Dispose();
			}
		}

		private static void OnReceiveSync(ulong _, FastBufferReader reader)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (!((FastBufferReader)(ref reader)).TryBeginRead(IntSize))
			{
				Debug.LogError((object)"Config sync error: Could not begin reading buffer.");
				return;
			}
			int num = default(int);
			((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
			if (!((FastBufferReader)(ref reader)).TryBeginRead(num))
			{
				Debug.LogError((object)"Config sync error: Host could not sync.");
				return;
			}
			byte[] data = new byte[num];
			((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
			SyncInstance(data);
			Debug.Log((object)"Successfully synced config with host.");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		public static void InitializeLocalPlayer()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			if (IsHost)
			{
				CustomMessagingManager messageManager = MessageManager;
				object obj = <>O.<0>__OnRequestSync;
				if (obj == null)
				{
					HandleNamedMessageDelegate val = OnRequestSync;
					<>O.<0>__OnRequestSync = val;
					obj = (object)val;
				}
				messageManager.RegisterNamedMessageHandler("LCM_VileVendingMachine|1.1.2_OnRequestConfigSync", (HandleNamedMessageDelegate)obj);
				Synced = true;
				return;
			}
			Synced = false;
			CustomMessagingManager messageManager2 = MessageManager;
			object obj2 = <>O.<1>__OnReceiveSync;
			if (obj2 == null)
			{
				HandleNamedMessageDelegate val2 = OnReceiveSync;
				<>O.<1>__OnReceiveSync = val2;
				obj2 = (object)val2;
			}
			messageManager2.RegisterNamedMessageHandler("LCM_VileVendingMachine|1.1.2_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2);
			RequestSync();
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
		public static void PlayerLeave()
		{
			RevertSync();
		}
	}
	internal static class Assets
	{
		private const string MainAssetBundleName = "vilevendingmachinebundle";

		public static AssetBundle MainAssetBundle;

		public static void PopulateAssetsFromFile()
		{
			if ((Object)(object)MainAssetBundle != (Object)null)
			{
				return;
			}
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			if (directoryName != null)
			{
				MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "vilevendingmachinebundle"));
				if ((Object)(object)MainAssetBundle != (Object)null)
				{
					return;
				}
				MainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.Combine(directoryName, "Assets"), "vilevendingmachinebundle"));
			}
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				VileVendingMachinePlugin.Mls.LogError((object)"Failed to load vilevendingmachine bundle");
			}
		}
	}
	public static class LobbyCompatibilityChecker
	{
		public static bool Enabled => Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility");

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void Init()
		{
			PluginHelper.RegisterPlugin("LethalCompanyVileVendingMachine", Version.Parse("1.1.2"), (CompatibilityLevel)2, (VersionStrictness)3);
		}
	}
	public class CompanyColaBehaviour : PhysicsProp
	{
		private ManualLogSource _mls;

		private string _colaId;

		[SerializeField]
		private ScanNodeProperties innerScanNode;

		[SerializeField]
		private ScanNodeProperties outerScanNode;

		public readonly NetworkVariable<bool> IsPartOfVendingMachine = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		private bool _networkEventsSubscribed;

		private void OnEnable()
		{
			SubscribeToNetworkEvents();
		}

		private void OnDisable()
		{
			UnsubscribeFromNetworkEvents();
		}

		public override void Start()
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).propColliders = ((Component)this).gameObject.GetComponentsInChildren<Collider>();
			List<LayerMask> list = new List<LayerMask>(((GrabbableObject)this).propColliders.Length);
			list.AddRange(((GrabbableObject)this).propColliders.Select((Collider propCollider) => propCollider.excludeLayers));
			((GrabbableObject)this).Start();
			for (int i = 0; i < ((GrabbableObject)this).propColliders.Length; i++)
			{
				if (i < list.Count)
				{
					((GrabbableObject)this).propColliders[i].excludeLayers = list[i];
				}
			}
			((GrabbableObject)this).grabbable = true;
			((GrabbableObject)this).grabbableToEnemies = true;
			if (((NetworkBehaviour)this).IsServer)
			{
				_colaId = Guid.NewGuid().ToString();
				SyncColaIdClientRpc(_colaId);
			}
		}

		public override void Update()
		{
			if (((GrabbableObject)this).isHeld)
			{
				EvaluateIsPartOfVendingMachine();
			}
			if (!IsPartOfVendingMachine.Value)
			{
				((GrabbableObject)this).Update();
			}
		}

		public override void LateUpdate()
		{
			//IL_0015: 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)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
			if (IsPartOfVendingMachine.Value)
			{
				if ((Object)(object)((Component)this).transform.parent != (Object)null)
				{
					((Component)this).transform.position = ((Component)this).transform.parent.position;
					((Component)this).transform.rotation = ((Component)this).transform.parent.rotation;
				}
			}
			else
			{
				((GrabbableObject)this).LateUpdate();
			}
		}

		public override void EquipItem()
		{
			((PhysicsProp)this).EquipItem();
			EvaluateIsPartOfVendingMachine();
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			EvaluateIsPartOfVendingMachine();
		}

		[ServerRpc(RequireOwnership = false)]
		private void SetIsPartOfVendingMachineServerRpc(bool value)
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3361990715u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3361990715u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					IsPartOfVendingMachine.Value = value;
				}
			}
		}

		private void EvaluateIsPartOfVendingMachine()
		{
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			if (IsPartOfVendingMachine.Value)
			{
				if (((NetworkBehaviour)this).IsServer)
				{
					IsPartOfVendingMachine.Value = false;
				}
				else
				{
					SetIsPartOfVendingMachineServerRpc(value: false);
				}
				Collider[] propColliders = ((GrabbableObject)this).propColliders;
				for (int i = 0; i < propColliders.Length; i++)
				{
					propColliders[i].excludeLayers = LayerMask.op_Implicit(-2621449);
				}
				Object.Destroy((Object)(object)((Component)this).GetComponent<Rigidbody>());
				Object.Destroy((Object)(object)outerScanNode);
			}
		}

		[HarmonyPatch(typeof(BeltBagItem), "PutObjectInBagLocalClient")]
		[HarmonyPostfix]
		private static void TriggerHeldActions(BeltBagItem __instance, GrabbableObject gObject)
		{
			if (gObject is CompanyColaBehaviour companyColaBehaviour)
			{
				((GrabbableObject)companyColaBehaviour).EquipItem();
			}
		}

		public void UpdateScrapValue(int value)
		{
			((GrabbableObject)this).SetScrapValue(value);
			if ((Object)(object)innerScanNode != (Object)null)
			{
				LogDebug("Inner scan node is not null");
				innerScanNode.scrapValue = value;
				innerScanNode.subText = $"Value: {value}";
			}
			if ((Object)(object)outerScanNode != (Object)null)
			{
				LogDebug("Outer scan node is not null");
				outerScanNode.scrapValue = value;
				outerScanNode.subText = $"Value: {value}";
			}
		}

		private void OnIsPartOfVendingMachineChanged(bool oldValue, bool newValue)
		{
			((GrabbableObject)this).grabbableToEnemies = !newValue;
			((GrabbableObject)this).grabbable = !newValue;
			((GrabbableObject)this).fallTime = ((!newValue) ? 1f : 0f);
		}

		private void SubscribeToNetworkEvents()
		{
			if (!_networkEventsSubscribed)
			{
				NetworkVariable<bool> isPartOfVendingMachine = IsPartOfVendingMachine;
				isPartOfVendingMachine.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)isPartOfVendingMachine.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsPartOfVendingMachineChanged));
				_networkEventsSubscribed = true;
			}
		}

		private void UnsubscribeFromNetworkEvents()
		{
			if (_networkEventsSubscribed)
			{
				NetworkVariable<bool> isPartOfVendingMachine = IsPartOfVendingMachine;
				isPartOfVendingMachine.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Remove((Delegate?)(object)isPartOfVendingMachine.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(OnIsPartOfVendingMachineChanged));
				_networkEventsSubscribed = false;
			}
		}

		[ClientRpc]
		public void SyncColaIdClientRpc(string receivedColaId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(463701966u, val, (RpcDelivery)0);
				bool flag = receivedColaId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedColaId, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 463701966u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				_colaId = receivedColaId;
				ManualLogSource mls = _mls;
				if (mls != null)
				{
					mls.Dispose();
				}
				_mls = Logger.CreateLogSource("LCM_VileVendingMachine|1.1.2 | Company Cola " + _colaId);
				LogDebug("Successfully synced company cola identifier.");
			}
		}

		private void LogDebug(string msg)
		{
		}

		protected override void __initializeVariables()
		{
			if (IsPartOfVendingMachine == null)
			{
				throw new Exception("CompanyColaBehaviour.IsPartOfVendingMachine cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)IsPartOfVendingMachine).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)IsPartOfVendingMachine, "IsPartOfVendingMachine");
			((NetworkBehaviour)this).NetworkVariableFields.Add((NetworkVariableBase)(object)IsPartOfVendingMachine);
			((PhysicsProp)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_CompanyColaBehaviour()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3361990715u, new RpcReceiveHandler(__rpc_handler_3361990715));
			NetworkManager.__rpc_func_table.Add(463701966u, new RpcReceiveHandler(__rpc_handler_463701966));
		}

		private static void __rpc_handler_3361990715(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_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool isPartOfVendingMachineServerRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isPartOfVendingMachineServerRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((CompanyColaBehaviour)(object)target).SetIsPartOfVendingMachineServerRpc(isPartOfVendingMachineServerRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_463701966(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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));
				string receivedColaId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedColaId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((CompanyColaBehaviour)(object)target).SyncColaIdClientRpc(receivedColaId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "CompanyColaBehaviour";
		}
	}
	public class NullableObject<T> where T : class
	{
		private T _value;

		public bool IsNotNull { get; private set; }

		public T Value
		{
			get
			{
				return _value;
			}
			set
			{
				_value = value;
				IsNotNull = _value != null;
			}
		}

		public NullableObject(T value = null)
		{
			Value = value;
		}
	}
	public enum LeftOrRight
	{
		Left = 1,
		Right
	}
	public enum EntranceOrExit
	{
		Entrance,
		Exit
	}
	public static class VendingMachineRegistry
	{
		public struct VendingMachinePlacement
		{
			public VileVendingMachineServer ServerScript;

			public int TeleportId;

			public Transform Transform;

			public LeftOrRight LeftOrRight;

			public EntranceOrExit EntranceOrExit;
		}

		private static readonly ManualLogSource Mls = new ManualLogSource("LCM_VileVendingMachine|1.1.2 | Vile Vending Machine Registry");

		private static readonly Dictionary<string, VendingMachinePlacement> VendingMachines = new Dictionary<string, VendingMachinePlacement>();

		public static bool IsPlacementInProgress;

		public static void AddVendingMachine(string id, int teleportId, LeftOrRight leftOrRight, EntranceOrExit entranceOrExit, Transform transform)
		{
			if (!IsVendingMachineInDict(id))
			{
				VendingMachinePlacement vendingMachinePlacement = default(VendingMachinePlacement);
				vendingMachinePlacement.TeleportId = teleportId;
				vendingMachinePlacement.LeftOrRight = leftOrRight;
				vendingMachinePlacement.EntranceOrExit = entranceOrExit;
				vendingMachinePlacement.Transform = transform;
				VendingMachinePlacement value = vendingMachinePlacement;
				VendingMachines[id] = value;
			}
		}

		public static void RemoveVendingMachine(string id)
		{
			if (IsVendingMachineInDict(id))
			{
				VendingMachines.Remove(id);
			}
		}

		public static bool IsDoorAndSideOccupied(int teleportId, LeftOrRight leftOrRight, EntranceOrExit entranceOrExit)
		{
			return VendingMachines.Any((KeyValuePair<string, VendingMachinePlacement> vendingMachineKeyValuePair) => vendingMachineKeyValuePair.Value.TeleportId == teleportId && vendingMachineKeyValuePair.Value.EntranceOrExit == entranceOrExit && vendingMachineKeyValuePair.Value.LeftOrRight == leftOrRight);
		}

		public static bool IsDoorOccupied(int teleportId, EntranceOrExit entranceOrExit)
		{
			return VendingMachines.Any((KeyValuePair<string, VendingMachinePlacement> vendingMachineKeyValuePair) => vendingMachineKeyValuePair.Value.TeleportId == teleportId && vendingMachineKeyValuePair.Value.EntranceOrExit == entranceOrExit);
		}

		private static bool IsVendingMachineInDict(string id)
		{
			if (id != null)
			{
				return VendingMachines.ContainsKey(id);
			}
			Mls.LogWarning((object)"Given string id was null, this should not happen.");
			return false;
		}

		public static Dictionary<string, VendingMachinePlacement> GetVendingMachineRegistry()
		{
			return VendingMachines;
		}

		public static string GetVendingMachineRegistryPrint()
		{
			return VendingMachines.Aggregate("", (string current, KeyValuePair<string, VendingMachinePlacement> keyValuePair) => current + $"Vending Machine Id: {keyValuePair.Key}, TeleportId: {keyValuePair.Value.TeleportId} EntranceOrExit: {keyValuePair.Value.EntranceOrExit}, LeftOrRight: {keyValuePair.Value.LeftOrRight}\n");
		}

		[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
		[HarmonyPostfix]
		private static void ResetRegistryOnRoundEnd(StartOfRound __instance)
		{
			VendingMachines.Clear();
		}
	}
	public class VileVendingMachineClient : MonoBehaviour
	{
		private enum AudioClipTypes
		{
			DropCan,
			Blend,
			FlapCreak,
			Crunch
		}

		private ManualLogSource _mls;

		private string _vendingMachineId;

		public static readonly int ArmAccept = Animator.StringToHash("accept");

		public static readonly int ArmGrab = Animator.StringToHash("grab");

		public static readonly int ArmRetract = Animator.StringToHash("retract");

		public static readonly int Grind = Animator.StringToHash("grind");

		public static readonly int Dispense = Animator.StringToHash("dispense");

		private const string StartPlaceItemText = "Place item: [E]";

		private const string PlacingItemText = "Placing item...";

		private const string NoItemsText = "No items to place.";

		private const string CannotPlaceItemText = "No space to place item.";

		private const string SomeoneAlreadyPlacingItemText = "Someone is already placing an item.";

		[Header("Audio")]
		[Space(5f)]
		[SerializeField]
		private AudioSource creatureVoiceSource;

		[SerializeField]
		private AudioSource creatureSfxSource;

		public AudioClip dropCanSfx;

		public AudioClip blendSfx;

		public AudioClip flapCreakFullSfx;

		public AudioClip crunchSfx;

		public AudioClip flapCreakOpenSfx;

		public AudioClip flapCreakCloseSfx;

		[Header("Colliders and Transforms")]
		[Space(5f)]
		[SerializeField]
		private BoxCollider centreCollider;

		[SerializeField]
		private BoxCollider frontCollider;

		[SerializeField]
		private BoxCollider backCollider;

		[SerializeField]
		private BoxCollider floorCollider;

		[SerializeField]
		private BoxCollider enemyCollider;

		[SerializeField]
		private Transform handBone;

		[SerializeField]
		private Transform itemHolder;

		[SerializeField]
		private Transform eye;

		[SerializeField]
		private Transform colaPlaceholder;

		[Header("Visuals")]
		[Space(5f)]
		[SerializeField]
		private Animator animator;

		[SerializeField]
		private SkinnedMeshRenderer bodyRenderer;

		[SerializeField]
		private MeshRenderer colaPlaceholderRenderer;

		[SerializeField]
		private VisualEffect materializeVfx;

		[SerializeField]
		private GameObject scanNode;

		[Header("Controllers")]
		[Space(5f)]
		[SerializeField]
		private VileVendingMachineNetcodeController netcodeController;

		[SerializeField]
		private InteractTrigger triggerScript;

		private bool _increasingFearLevel;

		private bool _networkEventsSubscribed;

		private readonly NullableObject<PlayerControllerB> _targetPlayer = new NullableObject<PlayerControllerB>();

		private readonly NullableObject<PlayerControllerB> _interactingWithPlayer = new NullableObject<PlayerControllerB>();

		private CompanyColaBehaviour _currentColaBehaviour;

		private void OnEnable()
		{
			SubscribeToNetworkEvents();
		}

		private void OnDisable()
		{
			UnsubscribeFromNetworkEvents();
		}

		private void Start()
		{
			_mls = Logger.CreateLogSource("LCM_VileVendingMachine|1.1.2 | Vile Vending Machine Client " + _vendingMachineId);
			triggerScript = ((Component)this).GetComponentInChildren<InteractTrigger>();
			((UnityEvent<PlayerControllerB>)(object)triggerScript.onInteract).AddListener((UnityAction<PlayerControllerB>)InteractVendingMachine);
			((UnityEvent<PlayerControllerB>)(object)triggerScript.onInteractEarly).AddListener((UnityAction<PlayerControllerB>)AssignPlayerInteractor);
			((UnityEvent<PlayerControllerB>)(object)triggerScript.onStopInteract).AddListener((UnityAction<PlayerControllerB>)AssignPlayerInteractor);
			((Component)triggerScript).tag = "InteractTrigger";
			triggerScript.interactCooldown = false;
			triggerScript.cooldownTime = 0f;
			((Renderer)colaPlaceholderRenderer).enabled = false;
		}

		private void Update()
		{
			UpdateInteractTriggers();
		}

		private void AssignPlayerInteractor(PlayerControllerB playerInteractor)
		{
			if (!netcodeController.IsItemOnHand.Value && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)playerInteractor)
			{
				_interactingWithPlayer.Value = playerInteractor;
			}
		}

		private void InteractVendingMachine(PlayerControllerB playerInteractor)
		{
			if (!((Object)(object)playerInteractor == (Object)null) && !netcodeController.IsItemOnHand.Value && playerInteractor.isHoldingObject && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)playerInteractor)
			{
				netcodeController.PlaceItemInHandServerRpc(_vendingMachineId, playerInteractor.actualClientId);
			}
		}

		private void HandlePlaceItemInHand(string receivedVendingMachineId, ulong targetPlayerId)
		{
			if (!(_vendingMachineId != receivedVendingMachineId))
			{
				((MonoBehaviour)this).StartCoroutine(PlaceItemInHand(targetPlayerId));
			}
		}

		private IEnumerator PlaceItemInHand(ulong targetPlayerId)
		{
			LogDebug("In PlaceItemInHand coroutine.");
			if (((NetworkBehaviour)netcodeController).IsOwner)
			{
				netcodeController.TargetPlayerClientId.Value = targetPlayerId;
			}
			PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[targetPlayerId];
			if ((Object)(object)player == (Object)null)
			{
				LogDebug($"There is no player with ID: {targetPlayerId}. Cannot place item onto vending machine's hand.");
				yield break;
			}
			GrabbableObject item = player.currentlyHeldObjectServer;
			Vector3 placePosition2 = ((Component)itemHolder).transform.position;
			placePosition2.y += item.itemProperties.verticalOffset;
			placePosition2 = itemHolder.InverseTransformPoint(placePosition2);
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player)
			{
				player.DiscardHeldObject(true, ((Component)this).GetComponent<NetworkObject>(), placePosition2, false);
			}
			yield return (object)new WaitForSeconds(0.12f);
			yield return null;
			item.isHeldByEnemy = true;
			item.grabbable = false;
			item.grabbableToEnemies = false;
			if (((NetworkBehaviour)netcodeController).IsOwner)
			{
				netcodeController.IsItemOnHand.Value = true;
			}
			item.EnablePhysics(false);
			((Component)item).transform.SetParent(itemHolder);
			((Component)item).transform.position = placePosition2;
			((Component)item).transform.rotation = ((item.floorYRot == -1) ? Quaternion.Euler(item.itemProperties.restingRotation.x, item.itemProperties.restingRotation.y, item.itemProperties.restingRotation.z) : Quaternion.Euler(item.itemProperties.restingRotation.x, (float)(item.floorYRot + item.itemProperties.floorYOffset) + 90f, item.itemProperties.restingRotation.z));
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player)
			{
				netcodeController.StartAcceptItemAnimationServerRpc(_vendingMachineId);
			}
		}

		private void HandleIncreaseFearLevelWhenPlayerBlended(string receivedVendingMachineId)
		{
			if (!(_vendingMachineId != receivedVendingMachineId))
			{
				_increasingFearLevel = true;
				LogDebug("Starting coroutine for increasing fear.");
				((MonoBehaviour)this).StartCoroutine(IncreaseFearLevelForArmGrab());
			}
		}

		private IEnumerator IncreaseFearLevelForArmGrab()
		{
			while (_increasingFearLevel)
			{
				if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(eye.position, 50f, 30, 3f))
				{
					LogDebug("Increasing fear level.");
					GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true);
					GameNetworkManager.Instance.localPlayerController.IncreaseFearLevelOverTime(0.8f, 1f);
				}
				yield return (object)new WaitForSeconds(0.15f);
			}
		}

		private IEnumerator KillTargetPlayer()
		{
			if (!_targetPlayer.IsNotNull)
			{
				_mls.LogError((object)"Tried to kill target player, but the target player variable is null.");
				yield break;
			}
			LogDebug("Killing player: " + ((Object)_targetPlayer.Value).name + ".");
			if ((Object)(object)HUDManager.Instance.localPlayer == (Object)(object)_targetPlayer.Value)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			else if (Vector3.Distance(((Component)HUDManager.Instance.localPlayer).transform.position, ((Component)this).transform.position) < 2f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
			}
			else if (Vector3.Distance(((Component)HUDManager.Instance.localPlayer).transform.position, ((Component)this).transform.position) < 8f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
			}
			yield return (object)new WaitForSeconds(0.05f);
			_targetPlayer.Value.KillPlayer(Vector3.zero, true, (CauseOfDeath)8, 0, default(Vector3));
			yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)_targetPlayer.Value.deadBody != (Object)null));
			_increasingFearLevel = false;
			if ((Object)(object)_targetPlayer.Value.deadBody != (Object)null)
			{
				_targetPlayer.Value.deadBody.attachedTo = ((Component)handBone).transform;
				_targetPlayer.Value.deadBody.attachedLimb = _targetPlayer.Value.deadBody.bodyParts[5];
				_targetPlayer.Value.deadBody.matchPositionExactly = true;
				Rigidbody[] bodyParts = _targetPlayer.Value.deadBody.bodyParts;
				for (int i = 0; i < bodyParts.Length; i++)
				{
					((Component)bodyParts[i]).GetComponent<Collider>().excludeLayers = LayerMask.op_Implicit(-1);
				}
			}
			yield return (object)new WaitForSeconds(1.5f);
			if ((Object)(object)_targetPlayer.Value.deadBody != (Object)null)
			{
				_targetPlayer.Value.deadBody.attachedTo = null;
				_targetPlayer.Value.deadBody.attachedLimb = null;
				_targetPlayer.Value.deadBody.matchPositionExactly = false;
				((Component)((Component)_targetPlayer.Value.deadBody).transform.GetChild(0)).gameObject.SetActive(false);
				_targetPlayer.Value.deadBody = null;
			}
		}

		public void OnAnimationEventEnableColaPhysics()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			PlaySfx(flapCreakFullSfx);
			if (((NetworkBehaviour)netcodeController).IsOwner)
			{
				netcodeController.IsItemOnHand.Value = false;
			}
			((GrabbableObject)_currentColaBehaviour).grabbable = true;
			((GrabbableObject)_currentColaBehaviour).grabbableToEnemies = true;
			((Component)_currentColaBehaviour).transform.SetParent((Transform)null);
			Rigidbody component = ((Component)_currentColaBehaviour).GetComponent<Rigidbody>();
			component.isKinematic = false;
			component.AddForce(((Component)this).transform.forward * 5f, (ForceMode)1);
			component.AddTorque(((Component)this).transform.right * 20f, (ForceMode)1);
		}

		private void UpdateInteractTriggers()
		{
			if (netcodeController.IsItemOnHand.Value)
			{
				SetInteractTriggers(interactable: false, "No space to place item.");
				return;
			}
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!localPlayerController.isHoldingObject)
			{
				SetInteractTriggers(interactable: false, "No items to place.");
			}
			else if (_interactingWithPlayer.IsNotNull)
			{
				if ((Object)(object)localPlayerController == (Object)(object)_interactingWithPlayer.Value)
				{
					SetInteractTriggers(interactable: true, "Placing item...");
				}
				else
				{
					SetInteractTriggers(interactable: false, "Someone is already placing an item.");
				}
			}
			else
			{
				SetInteractTriggers(interactable: true);
			}
		}

		private void SetInteractTriggers(bool interactable = false, string hoverTip = "Place item: [E]")
		{
			triggerScript.interactable = interactable;
			if (interactable)
			{
				triggerScript.hoverTip = hoverTip;
			}
			else
			{
				triggerScript.disabledHoverTip = hoverTip;
			}
		}

		public void OnAnimationEventKillPlayer()
		{
			((MonoBehaviour)this).StartCoroutine(KillTargetPlayer());
		}

		public void OnAnimationEventSpawnCola()
		{
			PlaySfx(crunchSfx, interrupt: false);
		}

		public void OnAnimationEventPlayBlendSfx()
		{
			PlaySfx(blendSfx);
		}

		public void OnAnimationEventDespawnHeldItem()
		{
			if (NetworkManager.Singleton.IsClient && ((NetworkBehaviour)netcodeController).IsOwner)
			{
				netcodeController.DespawnHeldItemServerRpc(_vendingMachineId);
			}
		}

		public void OnAnimationEventIncreaseFearLevelWhenPlayerBlended()
		{
			HandleIncreaseFearLevelWhenPlayerBlended(_vendingMachineId);
		}

		public void OnAnimationEventStopFearIncreasing()
		{
			_increasingFearLevel = false;
		}

		public void OnAnimationEventPlayFlapCreak(int type)
		{
			switch (type)
			{
			case 0:
				PlaySfx(flapCreakOpenSfx);
				break;
			case 1:
				PlaySfx(flapCreakCloseSfx);
				break;
			}
		}

		private void HandlePlayMaterializeVfx(string receivedVendingMachineId, Vector3 finalPosition, Quaternion finalRotation)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (!(_vendingMachineId != receivedVendingMachineId))
			{
				((MonoBehaviour)this).StartCoroutine(PlayMaterializeVfx(finalPosition, finalRotation));
			}
		}

		private IEnumerator PlayMaterializeVfx(Vector3 finalPosition, Quaternion finalRotation)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (netcodeController.MeshEnabled.Value && ((NetworkBehaviour)netcodeController).IsOwner)
			{
				netcodeController.MeshEnabled.Value = false;
			}
			((Component)this).transform.position = finalPosition;
			((Component)this).transform.rotation = finalRotation;
			Object.Destroy((Object)(object)((Component)frontCollider).gameObject);
			Object.Destroy((Object)(object)((Component)backCollider).gameObject);
			Object.Destroy((Object)(object)((Component)floorCollider).gameObject);
			Object.Destroy((Object)(object)((Component)centreCollider).gameObject);
			((Component)enemyCollider).gameObject.SetActive(true);
			materializeVfx.SendEvent("PlayMaterialize");
			if (((NetworkBehaviour)netcodeController).IsOwner)
			{
				yield return (object)new WaitForSeconds(3f);
				netcodeController.MeshEnabled.Value = true;
			}
		}

		private void HandleSetMeshEnabled(bool oldValue, bool newValue)
		{
			((Renderer)bodyRenderer).enabled = newValue;
			scanNode.SetActive(newValue);
		}

		private void HandleUpdateColaNetworkObjectReference(string receivedVendingMachineId, NetworkObjectReference colaNetworkObjectReference, int colaValue)
		{
			//IL_0049: 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)
			NetworkObject val = default(NetworkObject);
			if (!(_vendingMachineId != receivedVendingMachineId) && ((NetworkObjectReference)(ref colaNetworkObjectReference)).TryGet(ref val, (NetworkManager)null))
			{
				LogDebug("Cola network object reference was not null.");
				_currentColaBehaviour = ((Component)val).GetComponent<CompanyColaBehaviour>();
				((Component)_currentColaBehaviour).transform.position = ((Component)colaPlaceholder).transform.position;
				((Component)_currentColaBehaviour).transform.rotation = ((Component)colaPlaceholder).transform.rotation;
				((Component)_currentColaBehaviour).transform.SetParent(colaPlaceholder, false);
				_currentColaBehaviour.UpdateScrapValue(colaValue);
				((GrabbableObject)_currentColaBehaviour).grabbableToEnemies = false;
				((GrabbableObject)_currentColaBehaviour).fallTime = 1f;
				LogDebug("Cola parent is: " + ((Object)((Component)_currentColaBehaviour).transform.parent).name + ".");
			}
		}

		private void HandleInitializeConfigValues(string receivedVendingMachineId)
		{
			if (!(_vendingMachineId != receivedVendingMachineId))
			{
				creatureVoiceSource.volume = SyncedInstance<VileVendingMachineConfig>.Instance.SoundEffectsVolume.Value;
				creatureSfxSource.volume = SyncedInstance<VileVendingMachineConfig>.Instance.SoundEffectsVolume.Value;
			}
		}

		private void HandleSetAnimationTrigger(string receivedVendingMachineId, int parameter)
		{
			if (!(_vendingMachineId != receivedVendingMachineId))
			{
				animator.SetTrigger(parameter);
			}
		}

		private void HandlePlayCreatureSfx(string receivedVendingMachineId, int audioClipType, bool interrupt = true)
		{
			if (!(_vendingMachineId != receivedVendingMachineId))
			{
				AudioClip val = (AudioClip)(audioClipType switch
				{
					0 => dropCanSfx, 
					1 => blendSfx, 
					2 => flapCreakFullSfx, 
					3 => crunchSfx, 
					_ => null, 
				});
				if ((Object)(object)val == (Object)null)
				{
					_mls.LogError((object)$"Vending machine audio clip index '{audioClipType}' is null.");
				}
				else
				{
					PlaySfx(val, interrupt);
				}
			}
		}

		private void PlaySfx(AudioClip clip, bool interrupt = true)
		{
			if ((Object)(object)clip == (Object)null)
			{
				_mls.LogError((object)"Vending machine audio clip is null, could not play it.");
				return;
			}
			LogDebug("Playing audio clip: " + ((Object)clip).name + ".");
			if (interrupt)
			{
				creatureSfxSource.Stop(true);
			}
			creatureSfxSource.PlayOneShot(clip);
			WalkieTalkie.TransmitOneShotAudio(creatureSfxSource, clip, creatureSfxSource.volume);
		}

		private void HandleTargetPlayerChanged(ulong oldValue, ulong newValue)
		{
			_targetPlayer.Value = ((newValue == 69420) ? null : StartOfRound.Instance.allPlayerScripts[newValue]);
			LogDebug(_targetPlayer.IsNotNull ? ("Changed target player to " + _targetPlayer.Value.playerUsername) : "Changed target player to null");
		}

		private void HandleUpdateVendingMachineIdentifier(string receivedVendingMachineId)
		{
			_vendingMachineId = receivedVendingMachineId;
			ManualLogSource mls = _mls;
			if (mls != null)
			{
				mls.Dispose();
			}
			_mls = Logger.CreateLogSource("LCM_VileVendingMachine|1.1.2 | Vile Vending Machine Client " + _vendingMachineId);
			LogDebug("Successfully synced vending machine identifier.");
		}

		private void SubscribeToNetworkEvents()
		{
			if (!_networkEventsSubscribed)
			{
				netcodeController.OnInitializeConfigValues += HandleInitializeConfigValues;
				netcodeController.OnUpdateVendingMachineIdentifier += HandleUpdateVendingMachineIdentifier;
				netcodeController.OnSetAnimationTrigger += HandleSetAnimationTrigger;
				netcodeController.OnPlaceItemInHand += HandlePlaceItemInHand;
				netcodeController.OnUpdateColaNetworkObjectReference += HandleUpdateColaNetworkObjectReference;
				netcodeController.OnPlayMaterializeVfx += HandlePlayMaterializeVfx;
				netcodeController.OnPlayCreatureSfx += HandlePlayCreatureSfx;
				netcodeController.OnIncreaseFearLevelWhenPlayerBlended += HandleIncreaseFearLevelWhenPlayerBlended;
				NetworkVariable<ulong> targetPlayerClientId = netcodeController.TargetPlayerClientId;
				targetPlayerClientId.OnValueChanged = (OnValueChangedDelegate<ulong>)(object)Delegate.Combine((Delegate?)(object)targetPlayerClientId.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<ulong>(HandleTargetPlayerChanged));
				NetworkVariable<bool> meshEnabled = netcodeController.MeshEnabled;
				meshEnabled.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)meshEnabled.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(HandleSetMeshEnabled));
				_networkEventsSubscribed = true;
			}
		}

		private void UnsubscribeFromNetworkEvents()
		{
			if (_networkEventsSubscribed)
			{
				netcodeController.OnInitializeConfigValues -= HandleInitializeConfigValues;
				netcodeController.OnUpdateVendingMachineIdentifier -= HandleUpdateVendingMachineIdentifier;
				netcodeController.OnSetAnimationTrigger -= HandleSetAnimationTrigger;
				netcodeController.OnPlaceItemInHand -= HandlePlaceItemInHand;
				netcodeController.OnUpdateColaNetworkObjectReference -= HandleUpdateColaNetworkObjectReference;
				netcodeController.OnPlayMaterializeVfx -= HandlePlayMaterializeVfx;
				netcodeController.OnPlayCreatureSfx -= HandlePlayCreatureSfx;
				netcodeController.OnIncreaseFearLevelWhenPlayerBlended -= HandleIncreaseFearLevelWhenPlayerBlended;
				NetworkVariable<ulong> targetPlayerClientId = netcodeController.TargetPlayerClientId;
				targetPlayerClientId.OnValueChanged = (OnValueChangedDelegate<ulong>)(object)Delegate.Remove((Delegate?)(object)targetPlayerClientId.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<ulong>(HandleTargetPlayerChanged));
				NetworkVariable<bool> meshEnabled = netcodeController.MeshEnabled;
				meshEnabled.OnValueChanged = (OnValueChangedDelegate<bool>)(object)Delegate.Combine((Delegate?)(object)meshEnabled.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<bool>(HandleSetMeshEnabled));
				_networkEventsSubscribed = false;
			}
		}

		private void LogDebug(string msg)
		{
		}
	}
	public class VileVendingMachineConfig : SyncedInstance<VileVendingMachineConfig>
	{
		public readonly ConfigEntry<bool> VendingMachineEnabled;

		public readonly ConfigEntry<string> VendingMachineSpawnRarity;

		public readonly ConfigEntry<int> MaxAmount;

		public readonly ConfigEntry<bool> CanSpawnAtMainDoorMaster;

		public readonly ConfigEntry<bool> CanSpawnAtFireExitMaster;

		public readonly ConfigEntry<bool> CanSpawnOutsideMaster;

		public readonly ConfigEntry<bool> CanSpawnInsideMaster;

		public readonly ConfigEntry<bool> AlwaysSpawnOutsideMainEntrance;

		public readonly ConfigEntry<bool> UseRelaxedColliderIfNeeded;

		public readonly ConfigEntry<float> InitialKillProbability;

		public readonly ConfigEntry<float> KillProbabilityGrowthFactor;

		public readonly ConfigEntry<float> KillProbabilityReductionFactor;

		public readonly ConfigEntry<int> ExpensiveItemValue;

		public readonly ConfigEntry<float> SoundEffectsVolume;

		public readonly ConfigEntry<int> ColaMaxValue;

		public readonly ConfigEntry<int> ColaMinValue;

		public readonly ConfigEntry<int> CrushedColaMaxValue;

		public readonly ConfigEntry<int> CrushedColaMinValue;

		public readonly ConfigEntry<int> PlushieMaxValue;

		public readonly ConfigEntry<int> PlushieMinValue;

		public readonly ConfigEntry<int> PlushieSpawnRate;

		public readonly ConfigEntry<LevelTypes> PlushieSpawnLevel;

		public VileVendingMachineConfig(ConfigFile cfg)
		{
			InitInstance(this);
			VendingMachineEnabled = cfg.Bind<bool>("Vending Machine Spawn Values", "Vending Machine Enabled", true, "Whether the Vile Vending Machine is enabled (will spawn in games).");
			VendingMachineSpawnRarity = cfg.Bind<string>("Vending Machine Spawn Values", "Vending Machine Spawn Rarity", "All:30", "Spawn weight of the Vending Machine on all moons. You can to add to it any moon, just follow the format (also needs LLL installed for LE moons to work with this config).");
			MaxAmount = cfg.Bind<int>("Vending Machine Spawn Values", "Max Amount", 1, "The max amount of vending machines that can spawn.");
			CanSpawnAtMainDoorMaster = cfg.Bind<bool>("Vending Machine Spawn Values", "Can Spawn at Main Entrance", true, "Whether the vending machine can spawn at the main entrance.");
			CanSpawnAtFireExitMaster = cfg.Bind<bool>("Vending Machine Spawn Values", "Can Spawn at Fire Exit", false, "Whether the vending machine can spawn at a fire exit.");
			CanSpawnOutsideMaster = cfg.Bind<bool>("Vending Machine Spawn Values", "Can Spawn Outside", true, "Whether the vending machine can spawn outside.");
			CanSpawnInsideMaster = cfg.Bind<bool>("Vending Machine Spawn Values", "Can Spawn Inside", true, "Whether the vending machine can spawn inside the dungeon.");
			AlwaysSpawnOutsideMainEntrance = cfg.Bind<bool>("Vending Machine Spawn Values", "Always Spawn At Main Entrance First", true, "Whether a vending machine should always try to spawn outside the main entrance first, before considering fire exits or spawning inside the dungeon.");
			UseRelaxedColliderIfNeeded = cfg.Bind<bool>("Vending Machine Spawn Values", "Use Relaxed Collider if Needed", true, "Whether a vending machine should use a slightly smaller collider to find a suitable placement if the full size collider clips with a wall. Turning this on will result in more successful vending machine placements, but in some cases the vending machine may slightly clip into a wall.");
			InitialKillProbability = cfg.Bind<float>("General", "Initial Kill Probability", 0.01f, "The initial probability of the vending machine killing you when you give it an item.");
			KillProbabilityGrowthFactor = cfg.Bind<float>("General", "Kill Probability Growth Factor", 4.64f, "How much the probability of the vending machine killing you goes up when giving it an item (exponential).");
			KillProbabilityReductionFactor = cfg.Bind<float>("General", "Kill Probability Reduction Factor", 0.25f, "How much the probability of the vending machine killing you goes down when giving it an expensive item (the current probability is multiplied by this number, so a reduction factor of 0.25 means the probability of being killed goes down by 75%).");
			ExpensiveItemValue = cfg.Bind<int>("General", "Expensive Item Scrap Value", -1, "The scrap value of an item that is deemed 'expensive' by the vending machine. Leave it at -1 for the value to be automatically set to the maximum possible value of a cola.");
			ColaMinValue = cfg.Bind<int>("Item Spawn Values", "Company Cola Minimum Value", 60, "The minimum possible value of a company cola.");
			ColaMaxValue = cfg.Bind<int>("Item Spawn Values", "Company Cola Maximum Value", 90, "The maximum possible value of a company cola.");
			CrushedColaMinValue = cfg.Bind<int>("Item Spawn Values", "Crushed Company Cola Minimum Value", 1, "The minimum possible value of a crushed company cola.");
			CrushedColaMaxValue = cfg.Bind<int>("Item Spawn Values", "Crushed Company Cola Maximum Value", 5, "The maximum possible value of a crushed company cola.");
			PlushieMinValue = cfg.Bind<int>("Item Spawn Values", "Vile Vending Machine Plushie Minimum value", 30, "The minimum value that the Vile Vending Machine Plushie can be set to.");
			PlushieMaxValue = cfg.Bind<int>("Item Spawn Values", "Vile Vending Machine Plushie Maximum value", 75, "The maximum value that the Vile Vending Machine Plushie can be set to.");
			PlushieSpawnRate = cfg.Bind<int>("Item Spawn Values", "Vile Vending Machine Plushie Spawn Value", 5, "The weighted spawn rarity of the Vile Vending Machine Plushie.");
			PlushieSpawnLevel = cfg.Bind<LevelTypes>("Item Spawn Values", "Vile Vending Machine Plushie Spawn Level", (LevelTypes)(-1), "The LevelTypes that the Vile Vending Machine Plushie spawns in.");
			SoundEffectsVolume = cfg.Bind<float>("Audio", "Sound Effects Volume", 1f, "The volume of the sound effects from the vending machine.");
		}
	}
	public class VileVendingMachineNetcodeController : NetworkBehaviour
	{
		private ManualLogSource _mls;

		[HideInInspector]
		public readonly NetworkVariable<ulong> TargetPlayerClientId = new NetworkVariable<ulong>(0uL, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		[HideInInspector]
		public readonly NetworkVariable<bool> IsItemOnHand = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		[HideInInspector]
		public readonly NetworkVariable<bool> MeshEnabled = new NetworkVariable<bool>(false, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);

		public event Action<string> OnInitializeConfigValues;

		public event Action<string> OnUpdateVendingMachineIdentifier;

		public event Action<string, int> OnSetAnimationTrigger;

		public event Action<string, ulong> OnPlaceItemInHand;

		public event Action<string> OnDespawnHeldItem;

		public event Action<string, NetworkObjectReference, int> OnUpdateColaNetworkObjectReference;

		public event Action<string, Vector3, Quaternion> OnPlayMaterializeVfx;

		public event Action<string, int, bool> OnPlayCreatureSfx;

		public event Action<string> OnIncreaseFearLevelWhenPlayerBlended;

		public event Action<string> OnStartAcceptItemAnimation;

		private void Start()
		{
			_mls = Logger.CreateLogSource("LCM_VileVendingMachine|1.1.2 | Vile Vending Machine Netcode Controller");
		}

		[ServerRpc(RequireOwnership = false)]
		public void StartAcceptItemAnimationServerRpc(string receivedVendingMachineId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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 val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2061751714u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2061751714u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				this.OnStartAcceptItemAnimation?.Invoke(receivedVendingMachineId);
			}
		}

		[ClientRpc]
		public void IncreaseFearLevelWhenPlayerBlendedClientRpc(string receivedVendingMachineId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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(1434705244u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1434705244u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnIncreaseFearLevelWhenPlayerBlended?.Invoke(receivedVendingMachineId);
			}
		}

		[ClientRpc]
		public void PlaySfxClientRpc(string receivedVendingMachineId, int audioClipType, bool interrupt = true)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_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_00ce: 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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(231240709u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				BytePacker.WriteValueBitPacked(val2, audioClipType);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 231240709u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnPlayCreatureSfx?.Invoke(receivedVendingMachineId, audioClipType, interrupt);
			}
		}

		[ClientRpc]
		public void PlayMaterializeVfxClientRpc(string receivedVendingMachineId, Vector3 finalPosition, Quaternion finalRotation)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: 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(2745759725u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref finalPosition);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref finalRotation);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2745759725u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnPlayMaterializeVfx?.Invoke(receivedVendingMachineId, finalPosition, finalRotation);
			}
		}

		[ClientRpc]
		public void UpdateColaNetworkObjectReferenceClientRpc(string receivedVendingMachineId, NetworkObjectReference colaNetworkObjectReference, int colaValue)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: 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_00bb: 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_00ca: 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)
			//IL_012d: 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(4113196162u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref colaNetworkObjectReference, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, colaValue);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4113196162u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnUpdateColaNetworkObjectReference?.Invoke(receivedVendingMachineId, colaNetworkObjectReference, colaValue);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void PlaceItemInHandServerRpc(string receivedVendingMachineId, ulong targetPlayerId)
		{
			//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_00af: 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)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(840296945u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				BytePacker.WriteValueBitPacked(val2, targetPlayerId);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 840296945u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlaceItemInHandClientRpc(receivedVendingMachineId, targetPlayerId);
			}
		}

		[ClientRpc]
		public void PlaceItemInHandClientRpc(string receivedVendingMachineId, ulong targetPlayerId)
		{
			//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_00af: 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)
			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(3572767402u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				BytePacker.WriteValueBitPacked(val2, targetPlayerId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3572767402u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnPlaceItemInHand?.Invoke(receivedVendingMachineId, targetPlayerId);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DespawnHeldItemServerRpc(string receivedVendingMachineId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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 val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(41413484u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 41413484u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				this.OnDespawnHeldItem?.Invoke(receivedVendingMachineId);
			}
		}

		[ClientRpc]
		public void InitializeConfigValuesClientRpc(string receivedVendingMachineId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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(2625731915u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2625731915u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnInitializeConfigValues?.Invoke(receivedVendingMachineId);
			}
		}

		[ClientRpc]
		public void SyncVendingMachineIdClientRpc(string receivedVendingMachineId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: 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_00ba: 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(754306932u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 754306932u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnUpdateVendingMachineIdentifier?.Invoke(receivedVendingMachineId);
			}
		}

		[ClientRpc]
		public void SetAnimationTriggerClientRpc(string receivedVendingMachineId, int animationId)
		{
			//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_00af: 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)
			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(2352477106u, val, (RpcDelivery)0);
				bool flag = receivedVendingMachineId != null;
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
				if (flag)
				{
					((FastBufferWriter)(ref val2)).WriteValueSafe(receivedVendingMachineId, false);
				}
				BytePacker.WriteValueBitPacked(val2, animationId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2352477106u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				this.OnSetAnimationTrigger?.Invoke(receivedVendingMachineId, animationId);
			}
		}

		private void LogDebug(string msg)
		{
		}

		protected override void __initializeVariables()
		{
			if (TargetPlayerClientId == null)
			{
				throw new Exception("VileVendingMachineNetcodeController.TargetPlayerClientId cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)TargetPlayerClientId).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)TargetPlayerClientId, "TargetPlayerClientId");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)TargetPlayerClientId);
			if (IsItemOnHand == null)
			{
				throw new Exception("VileVendingMachineNetcodeController.IsItemOnHand cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)IsItemOnHand).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)IsItemOnHand, "IsItemOnHand");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)IsItemOnHand);
			if (MeshEnabled == null)
			{
				throw new Exception("VileVendingMachineNetcodeController.MeshEnabled cannot be null. All NetworkVariableBase instances must be initialized.");
			}
			((NetworkVariableBase)MeshEnabled).Initialize((NetworkBehaviour)(object)this);
			((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)MeshEnabled, "MeshEnabled");
			base.NetworkVariableFields.Add((NetworkVariableBase)(object)MeshEnabled);
			((NetworkBehaviour)this).__initializeVariables();
		}

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_VileVendingMachineNetcodeController()
		{
			//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
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(2061751714u, new RpcReceiveHandler(__rpc_handler_2061751714));
			NetworkManager.__rpc_func_table.Add(1434705244u, new RpcReceiveHandler(__rpc_handler_1434705244));
			NetworkManager.__rpc_func_table.Add(231240709u, new RpcReceiveHandler(__rpc_handler_231240709));
			NetworkManager.__rpc_func_table.Add(2745759725u, new RpcReceiveHandler(__rpc_handler_2745759725));
			NetworkManager.__rpc_func_table.Add(4113196162u, new RpcReceiveHandler(__rpc_handler_4113196162));
			NetworkManager.__rpc_func_table.Add(840296945u, new RpcReceiveHandler(__rpc_handler_840296945));
			NetworkManager.__rpc_func_table.Add(3572767402u, new RpcReceiveHandler(__rpc_handler_3572767402));
			NetworkManager.__rpc_func_table.Add(41413484u, new RpcReceiveHandler(__rpc_handler_41413484));
			NetworkManager.__rpc_func_table.Add(2625731915u, new RpcReceiveHandler(__rpc_handler_2625731915));
			NetworkManager.__rpc_func_table.Add(754306932u, new RpcReceiveHandler(__rpc_handler_754306932));
			NetworkManager.__rpc_func_table.Add(2352477106u, new RpcReceiveHandler(__rpc_handler_2352477106));
		}

		private static void __rpc_handler_2061751714(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((VileVendingMachineNetcodeController)(object)target).StartAcceptItemAnimationServerRpc(receivedVendingMachineId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1434705244(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((VileVendingMachineNetcodeController)(object)target).IncreaseFearLevelWhenPlayerBlendedClientRpc(receivedVendingMachineId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_231240709(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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: 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_00ab: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				int audioClipType = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref audioClipType);
				bool interrupt = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref interrupt, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((VileVendingMachineNetcodeController)(object)target).PlaySfxClientRpc(receivedVendingMachineId, audioClipType, interrupt);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2745759725(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_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_009d: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				Vector3 finalPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref finalPosition);
				Quaternion finalRotation = default(Quaternion);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref finalRotation);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((VileVendingMachineNetcodeController)(object)target).PlayMaterializeVfxClientRpc(receivedVendingMachineId, finalPosition, finalRotation);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4113196162(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_0067: 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_0076: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				NetworkObjectReference colaNetworkObjectReference = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref colaNetworkObjectReference, default(ForNetworkSerializable));
				int colaValue = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref colaValue);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((VileVendingMachineNetcodeController)(object)target).UpdateColaNetworkObjectReferenceClientRpc(receivedVendingMachineId, colaNetworkObjectReference, colaValue);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_840296945(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_005b: 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_008c: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				ulong targetPlayerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((VileVendingMachineNetcodeController)(object)target).PlaceItemInHandServerRpc(receivedVendingMachineId, targetPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3572767402(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_005b: 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_008c: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				ulong targetPlayerId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref targetPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((VileVendingMachineNetcodeController)(object)target).PlaceItemInHandClientRpc(receivedVendingMachineId, targetPlayerId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_41413484(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((VileVendingMachineNetcodeController)(object)target).DespawnHeldItemServerRpc(receivedVendingMachineId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2625731915(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((VileVendingMachineNetcodeController)(object)target).InitializeConfigValuesClientRpc(receivedVendingMachineId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_754306932(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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((VileVendingMachineNetcodeController)(object)target).SyncVendingMachineIdClientRpc(receivedVendingMachineId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2352477106(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_005b: 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_008c: 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));
				string receivedVendingMachineId = null;
				if (flag)
				{
					((FastBufferReader)(ref reader)).ReadValueSafe(ref receivedVendingMachineId, false);
				}
				int animationId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref animationId);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((VileVendingMachineNetcodeController)(object)target).SetAnimationTriggerClientRpc(receivedVendingMachineId, animationId);
				target.__rpc_exec_stage = (__RpcExe