Decompiled source of Quick Buy Menu v1.2.0

BepInEx/plugins/QuickBuyMenu.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using QuickBuyMenu.NetcodePatcher;
using QuickBuyMenu.NetworkHandler;
using SimpleCommand.API;
using SimpleCommand.API.Classes;
using TerminalApi;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: AssemblyCompany("QuickBuyMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("An experimental mod for providing an alternative means to purchase handheld items instantly from the Terminal.")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1")]
[assembly: AssemblyProduct("QuickBuyMenu")]
[assembly: AssemblyTitle("QuickBuyMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace QuickBuyMenu
{
	[BepInPlugin("QuickBuyMenu", "QuickBuyMenu", "1.1.1")]
	[BepInDependency("atomic.terminalapi", "1.5.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private static Plugin Instance;

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log = ((BaseUnityPlugin)this).Logger;
			NetcodeWeaver();
			Log.LogInfo((object)"Plugin QuickBuyMenu is loaded!");
			SimpleCommandModule val = new SimpleCommandModule();
			val.DisplayName = "quickbuy";
			val.Description = "Displays the Quick Buy Menu for purchasing items quickly.";
			val.HasDynamicInput = false;
			val.Abbreviations = new string[5] { "qb", "quickb", "QB", "qbuy", "QBUY" };
			val.Method = QuickBuyItemList;
			SimpleCommandModule val2 = val;
			val = new SimpleCommandModule();
			val.Method = RunQuickBuy;
			val.DisplayName = "buy";
			val.Description = "Purchases the given item based off the items ID number.";
			val.HasDynamicInput = true;
			val.Arguments = new string[1] { "itemID" };
			val.HideFromCommandList = true;
			SimpleCommandModule val3 = val;
			SimpleCommand.AddSimpleCommand(val2);
			SimpleCommand.AddSimpleCommand(val3);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
		}

		private void NetcodeWeaver()
		{
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}

		private static TerminalNode QuickBuyItemList(Terminal __terminal)
		{
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("QUICK BUY MENU\n");
			for (int i = 0; i < __terminal.buyableItemsList.Length; i++)
			{
				stringBuilder.Append("\n* " + __terminal.buyableItemsList[i].itemName + "  //  Price: $" + (float)__terminal.buyableItemsList[i].creditsWorth * ((float)__terminal.itemSalesPercentages[i] / 100f));
				if (__terminal.itemSalesPercentages[i] != 100)
				{
					stringBuilder.Append($"   ({100 - __terminal.itemSalesPercentages[i]}% OFF!)");
				}
			}
			stringBuilder.Append("\n\nMake your selection by entering:\nbuy (Item Name)\n");
			stringBuilder.Append("or:\nbuy (Quantity) (Item Name)\n\n");
			return TerminalApi.CreateTerminalNode(stringBuilder.ToString(), true, "");
		}

		private static TerminalNode RunQuickBuy(Terminal __terminal)
		{
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			string text = RemovePunctuation(__terminal.screenText.text.Substring(__terminal.screenText.text.Length - __terminal.textAdded));
			text = text.Substring(4);
			string[] array = text.Split(' ');
			int result;
			string text2;
			if (array.Length > 1)
			{
				if (!int.TryParse(array[0], out result))
				{
					return TerminalApi.CreateTerminalNode("Invalid Argument for number of items: " + array[0] + "\n", true, "");
				}
				if (result < 1)
				{
					return TerminalApi.CreateTerminalNode("Argument for number of items must be greater than or equal to 1\n", true, "");
				}
				text2 = array[1];
			}
			else
			{
				result = 1;
				text2 = array[0];
			}
			Log.LogDebug((object)("Terminal Input from purchase command: " + text2));
			int num = FindItemIndex(__terminal, text2);
			TerminalNode result2;
			if (num != -1)
			{
				Item val = __terminal.buyableItemsList[num];
				float num2 = (float)__terminal.buyableItemsList[num].creditsWorth * ((float)__terminal.itemSalesPercentages[num] / 100f) * (float)result;
				if ((float)__terminal.groupCredits - num2 < 0f)
				{
					result2 = ((result > 1) ? TerminalApi.CreateTerminalNode($"You have insufficient funds to purchase {result} {val.itemName}s at a cost of {num2}\n", true, "") : TerminalApi.CreateTerminalNode($"You have insufficient funds to purchase a {val.itemName} at a cost of {num2}\n", true, ""));
				}
				else
				{
					for (int i = 0; i < result; i++)
					{
						if (GameNetworkManager.Instance.localPlayerController.FirstEmptyItemSlot() != -1)
						{
							float num3 = Mathf.Clamp(__terminal.buyableItemsList[num].weight - 1f, 0f, 10f);
							Log.LogDebug((object)$"Item carry weight: {num3}\n Current Player weight: {GameNetworkManager.Instance.localPlayerController.carryWeight}");
							PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
							localPlayerController.carryWeight += num3;
						}
						QuickBuyNetworkHandler.Instance.EventServerRpc(num, NetworkManager.Singleton.LocalClientId, i - 3);
					}
					__terminal.groupCredits -= (int)num2;
					QuickBuyNetworkHandler.Instance.SyncGroupCreditsServerRpc(__terminal.groupCredits, __terminal.numberOfItemsInDropship);
					result2 = ((result > 1) ? TerminalApi.CreateTerminalNode($"You have purchased {result} {val.itemName}s at a total cost of {num2}\n", true, "") : TerminalApi.CreateTerminalNode($"You have purchased a {val.itemName} at a cost of {num2}\n", true, ""));
				}
			}
			else
			{
				result2 = TerminalApi.CreateTerminalNode("Item not found in store: " + text + "\n", true, "");
			}
			return result2;
		}

		private static int FindItemIndex(Terminal terminal, string input)
		{
			return Array.FindIndex(terminal.buyableItemsList, (Item item) => item.itemName.Replace('-', ' ').IndexOf(input.Replace('-', ' '), StringComparison.OrdinalIgnoreCase) >= 0);
		}

		private static string RemovePunctuation(string s)
		{
			StringBuilder stringBuilder = new StringBuilder();
			for (int i = 0; i < s.Length; i++)
			{
				char c = s[i];
				if (c.Equals('-') || (!char.IsSymbol(c) && !char.IsPunctuation(c)))
				{
					stringBuilder.Append(c);
				}
			}
			return stringBuilder.ToString().ToLower();
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "QuickBuyMenu";

		public const string PLUGIN_NAME = "QuickBuyMenu";

		public const string PLUGIN_VERSION = "1.1.1";
	}
}
namespace QuickBuyMenu.Patches
{
	[HarmonyPatch]
	internal class NetworkManagerPatch
	{
		private static GameObject networkPrefab;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "QuickBuyMenuAssets"));
				networkPrefab = (GameObject)val.LoadAsset("QuickBuyNetworkHandler");
				networkPrefab.AddComponent<QuickBuyNetworkHandler>();
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
				if (val != null)
				{
					val.GetComponent<NetworkObject>().Spawn(false);
				}
			}
		}
	}
}
namespace QuickBuyMenu.NetworkHandler
{
	public class QuickBuyNetworkHandler : NetworkBehaviour
	{
		public static QuickBuyNetworkHandler Instance { get; private set; }

		public static event Action<string> LevelEvent;

		public override void OnNetworkSpawn()
		{
			QuickBuyNetworkHandler.LevelEvent = null;
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				QuickBuyNetworkHandler instance = Instance;
				if ((Object)(object)instance != (Object)null)
				{
					((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
				}
			}
			Instance = this;
			((NetworkBehaviour)this).OnNetworkSpawn();
		}

		[ClientRpc]
		public void EventClientRpc(ulong clientId, NetworkObjectReference obj = default(NetworkObjectReference), ClientRpcParams clientRpcParams = default(ClientRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0268: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: 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))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1911613558u, clientRpcParams, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, clientId);
				((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 1911613558u, clientRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost) || clientId != NetworkManager.Singleton.LocalClientId)
			{
				return;
			}
			PlayerControllerB val2 = GameNetworkManager.Instance.localPlayerController.playersManager.allPlayerScripts[clientId];
			Plugin.Log.LogDebug((object)$"Running EventClientRPC method\n${val2.playerUsername}, client ID: {val2.actualClientId}\n");
			NetworkObject val3 = default(NetworkObject);
			if (!((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null))
			{
				return;
			}
			GrabbableObject component = ((Component)val3).GetComponent<GrabbableObject>();
			GrabbableObject currentlyHeldObjectServer = val2.currentlyHeldObjectServer;
			if (currentlyHeldObjectServer != null)
			{
				currentlyHeldObjectServer.EnableItemMeshes(false);
			}
			component.EnableItemMeshes(true);
			component.playerHeldBy = val2;
			component.playerHeldBy.currentlyGrabbingObject = component;
			component.playerHeldBy.currentlyHeldObjectServer = component;
			string itemName = component.itemProperties.itemName;
			string text = itemName;
			if (!(text == "Lockpicker"))
			{
				if (text == "Shotgun")
				{
					((Component)component).GetComponent<ShotgunItem>().previousPlayerHeldBy = val2;
					((GrabbableObject)((Component)component).GetComponent<ShotgunItem>()).hasBeenHeld = true;
					((Component)component).GetComponent<ShotgunItem>().previousPlayerHeldBy.equippedUsableItemQE = true;
					((Component)component).GetComponentInParent<Component>().gameObject.GetComponentInChildren<ScanNodeProperties>().nodeType = 2;
				}
			}
			else
			{
				((Component)component).GetComponent<LockPicker>().lockPickerAudio = ((Component)component).gameObject.GetComponent<AudioSource>();
			}
			if (!NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GrabObjectSyncServerRpc(clientId, NetworkObjectReference.op_Implicit(((Component)component).GetComponent<NetworkObject>()));
			}
			else
			{
				component.playerHeldBy.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((Component)component).GetComponent<NetworkObject>()));
			}
			Coroutine grabObjectCoroutine = component.playerHeldBy.grabObjectCoroutine;
			if (grabObjectCoroutine != null)
			{
				((MonoBehaviour)GameNetworkManager.Instance).StopCoroutine(grabObjectCoroutine);
			}
			component.playerHeldBy.grabObjectCoroutine = ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutineManaged2(component.playerHeldBy.GrabObject());
		}

		[ServerRpc(RequireOwnership = false)]
		public void EventServerRpc(int itemID, ulong clientId, int itemIndex, ServerRpcParams serverRpcParams = default(ServerRpcParams))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: 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))
			{
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2773582618u, serverRpcParams, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, itemID);
				BytePacker.WriteValueBitPacked(val, clientId);
				BytePacker.WriteValueBitPacked(val, itemIndex);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2773582618u, serverRpcParams, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				PlayerControllerB val2 = GameNetworkManager.Instance.localPlayerController.playersManager.allPlayerScripts[clientId];
				Plugin.Log.LogDebug((object)$"Running EventServerRPC method\n${val2.playerUsername}, client ID: {val2.actualClientId}\n");
				Terminal val3 = Object.FindObjectOfType<Terminal>();
				bool flag = val2.FirstEmptyItemSlot() == -1;
				Vector3 position = ((Component)val2).transform.position;
				if (flag)
				{
					position.x = (float)((double)((Component)val2).transform.position.x + (double)itemIndex * -0.5);
				}
				GameObject val4 = Object.Instantiate<GameObject>(val3.buyableItemsList[itemID].spawnPrefab, position, Quaternion.identity);
				NetworkObject component = val4.GetComponent<NetworkObject>();
				component.Spawn(false);
				component.ChangeOwnership(clientId);
				if (!flag)
				{
					EventClientRpc(clientId, NetworkObjectReference.op_Implicit(component));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void GrabObjectSyncServerRpc(ulong clientId, NetworkObjectReference obj)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2303539470u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, clientId);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2303539470u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayerControllerB val3 = GameNetworkManager.Instance.localPlayerController.playersManager.allPlayerScripts[clientId];
					Plugin.Log.LogDebug((object)$"Running GrabObjectSyncServerRpc method\n${val3.playerUsername}, client ID: {val3.actualClientId}\n");
					NetworkObject val4 = NetworkObjectReference.op_Implicit(obj);
					val3.GrabObjectClientRpc(true, NetworkObjectReference.op_Implicit(val4));
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SyncGroupCreditsServerRpc(int groupCredits, int numItemsInDropShip)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3285421851u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, groupCredits);
					BytePacker.WriteValueBitPacked(val2, numItemsInDropShip);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3285421851u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					Terminal val3 = Object.FindObjectOfType<Terminal>();
					val3.SyncGroupCreditsServerRpc(groupCredits, numItemsInDropShip);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_QuickBuyNetworkHandler()
		{
			//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
			NetworkManager.__rpc_func_table.Add(1911613558u, new RpcReceiveHandler(__rpc_handler_1911613558));
			NetworkManager.__rpc_func_table.Add(2773582618u, new RpcReceiveHandler(__rpc_handler_2773582618));
			NetworkManager.__rpc_func_table.Add(2303539470u, new RpcReceiveHandler(__rpc_handler_2303539470));
			NetworkManager.__rpc_func_table.Add(3285421851u, new RpcReceiveHandler(__rpc_handler_3285421851));
		}

		private static void __rpc_handler_1911613558(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				ClientRpcParams client = rpcParams.Client;
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((QuickBuyNetworkHandler)(object)target).EventClientRpc(clientId, obj, client);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2773582618(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int itemID = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref itemID);
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				int itemIndex = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref itemIndex);
				ServerRpcParams server = rpcParams.Server;
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((QuickBuyNetworkHandler)(object)target).EventServerRpc(itemID, clientId, itemIndex, server);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2303539470(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				ulong clientId = default(ulong);
				ByteUnpacker.ReadValueBitPacked(reader, ref clientId);
				NetworkObjectReference obj = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((QuickBuyNetworkHandler)(object)target).GrabObjectSyncServerRpc(clientId, obj);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3285421851(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int groupCredits = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref groupCredits);
				int numItemsInDropShip = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref numItemsInDropShip);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((QuickBuyNetworkHandler)(object)target).SyncGroupCreditsServerRpc(groupCredits, numItemsInDropShip);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "QuickBuyNetworkHandler";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace QuickBuyMenu.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}