Decompiled source of MZCoMagicShipping v1.1.0

BepInEx/plugins/MZCoMagicShipping/com.github.xuuxiaolan.mzcomagicshipping.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using CodeRebirthLib;
using CodeRebirthLib.AssetManagement;
using CodeRebirthLib.ContentManagement;
using CodeRebirthLib.ContentManagement.Unlockables;
using CodeRebirthLib.Extensions;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.Events;
using com.github.xuuxiaolan.mzcomagicshipping.NetcodePatcher;

[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: AssemblyCompany("com.github.xuuxiaolan.mzcomagicshipping")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("MZCoMagicShipping")]
[assembly: AssemblyTitle("com.github.xuuxiaolan.mzcomagicshipping")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MZCoMagicShipping
{
	[BepInPlugin("com.github.xuuxiaolan.mzcomagicshipping", "MZCoMagicShipping", "1.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class MZCoMagicShipping : BaseUnityPlugin
	{
		internal static ManualLogSource Logger { get; private set; }

		public static CRMod Mod { get; private set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			NetcodePatcher();
			AssetBundle val = CRLib.LoadBundle(Assembly.GetExecutingAssembly(), "mzcomagicshippingmainasset");
			Mod = CRLib.RegisterMod((BaseUnityPlugin)(object)this, val);
			Mod.Logger = Logger;
			Mod.RegisterContentHandlers();
			Logger.LogInfo((object)"com.github.xuuxiaolan.mzcomagicshipping v1.1.0 has loaded!");
		}

		private void NetcodePatcher()
		{
			IEnumerable<Type> loadableTypes = AssemblyExtensions.GetLoadableTypes(Assembly.GetExecutingAssembly());
			foreach (Type item in loadableTypes)
			{
				if (item.IsNested)
				{
					continue;
				}
				MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array = methods;
				foreach (MethodInfo methodInfo in array)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.github.xuuxiaolan.mzcomagicshipping";

		public const string PLUGIN_NAME = "MZCoMagicShipping";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace MZCoMagicShipping.Content
{
	public class MagicShippingCrate : NetworkBehaviour
	{
		[SerializeField]
		private AudioSource _audioSource;

		[SerializeField]
		private AudioClip _spawnSound;

		[SerializeField]
		private AudioClip _openCrateSound;

		[SerializeField]
		private GameObject[] _itemSpotsForSpawning = Array.Empty<GameObject>();

		[SerializeField]
		private List<(Item item, int quantity)> _itemsToSpawnInOrder = new List<(Item, int)>();

		[SerializeField]
		private InteractTrigger _interactTrigger;

		[SerializeField]
		private NetworkAnimator _networkAnimator;

		[SerializeField]
		private GameObject[] _gameObjectsToEnableOrDisable = Array.Empty<GameObject>();

		private Coroutine? waitingRoutine;

		private int _numberToSpawnOfEachItem = 1;

		private void Start()
		{
			_audioSource.PlayOneShot(_spawnSound);
			((UnityEvent<PlayerControllerB>)(object)_interactTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)OpenCrateInteract);
			CRUnlockableDefinition val = default(CRUnlockableDefinition);
			if (!CRModUnlockableExtensions.TryGetFromUnlockableName(MZCoMagicShipping.Mod.UnlockableRegistry(), "Magic Shipping Crate", ref val))
			{
				return;
			}
			IEnumerable<string> enumerable = from s in ((CRContentDefinition)val).GetGeneralConfig<string>("Magic Shipping Crate | Items To Spawn").Value.Split(',')
				select s.Trim() into s
				where !string.IsNullOrEmpty(s)
				select s;
			List<(string, int)> list = new List<(string, int)>();
			foreach (string item3 in enumerable)
			{
				string item = item3.Split(':')[0];
				int item2 = int.Parse(item3.Split(':')[1]);
				list.Add((item, item2));
			}
			foreach (var (itemName, quantity) in list)
			{
				AddItemToList(itemName, quantity);
			}
		}

		private void AddItemToList(string itemName, int quantity)
		{
			foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
			{
				MZCoMagicShipping.Logger.LogDebug((object)("Seeing if " + itemName + " in config matches " + items.itemName));
				if (items.itemName.Equals(itemName, StringComparison.OrdinalIgnoreCase))
				{
					_itemsToSpawnInOrder.Add((items, quantity));
					break;
				}
			}
		}

		public void OpenCrateInteract(PlayerControllerB player)
		{
			if (!((Object)(object)player != (Object)(object)GameNetworkManager.Instance.localPlayerController))
			{
				OpenCrateServerRpc();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void OpenCrateServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			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(3393930415u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3393930415u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && waitingRoutine == null)
				{
					waitingRoutine = ((MonoBehaviour)this).StartCoroutine(WaitUntilBackInOrbit());
				}
			}
		}

		private IEnumerator WaitUntilBackInOrbit()
		{
			PlaySoundClientRpc(0);
			_networkAnimator.SetTrigger("open");
			yield return (object)new WaitUntil((Func<bool>)(() => !StartOfRound.Instance.inShipPhase));
			yield return (object)new WaitUntil((Func<bool>)(() => StartOfRound.Instance.inShipPhase));
			_networkAnimator.SetTrigger("respawn");
			PlaySoundClientRpc(1);
			waitingRoutine = null;
		}

		[ClientRpc]
		private void PlaySoundClientRpc(int soundID)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			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(2428105445u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, soundID);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2428105445u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				switch (soundID)
				{
				case 0:
					_audioSource.PlayOneShot(_openCrateSound);
					break;
				case 1:
					((Component)_audioSource).gameObject.SetActive(true);
					_audioSource.PlayOneShot(_spawnSound);
					break;
				}
			}
		}

		public void DisableOrEnableEverythingAnimEvent(int enable)
		{
			//IL_005e: 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)
			bool flag = enable == 1;
			((MonoBehaviour)this).StartCoroutine(DelayEnableOrDisablingEverything(flag));
			if (flag || !((NetworkBehaviour)this).IsServer)
			{
				return;
			}
			int num = 0;
			foreach (var item3 in _itemsToSpawnInOrder)
			{
				Item item = item3.item;
				int item2 = item3.quantity;
				for (int i = 0; i < _numberToSpawnOfEachItem; i++)
				{
					for (int j = 0; j < item2; j++)
					{
						SpawnItem(item, _itemSpotsForSpawning[num].transform.position);
					}
				}
				num++;
				if (num == _itemSpotsForSpawning.Length)
				{
					num = 0;
				}
			}
		}

		private IEnumerator DelayEnableOrDisablingEverything(bool enableEverything)
		{
			if (!enableEverything)
			{
				yield return (object)new WaitForSeconds(2f);
			}
			GameObject[] gameObjectsToEnableOrDisable = _gameObjectsToEnableOrDisable;
			foreach (GameObject val in gameObjectsToEnableOrDisable)
			{
				val.SetActive(enableEverything);
			}
		}

		public NetworkObjectReference SpawnItem(Item? item, Vector3 position)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: 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_0047: 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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)item == (Object)null)
			{
				return default(NetworkObjectReference);
			}
			Transform val = null;
			if ((Object)(object)val == (Object)null)
			{
				val = StartOfRound.Instance.propsContainer;
			}
			Vector3 val2 = position + Vector3.up * 0.2f;
			GameObject val3 = Object.Instantiate<GameObject>(item.spawnPrefab, val2, Quaternion.identity, val);
			NetworkObject component = val3.GetComponent<NetworkObject>();
			GrabbableObject component2 = val3.GetComponent<GrabbableObject>();
			component2.fallTime = 0f;
			component.Spawn(false);
			UpdateParentServerRpc(new NetworkObjectReference(component));
			int num = (int)((float)Random.Range(item.minValue, item.maxValue) * RoundManager.Instance.scrapValueMultiplier);
			ScanNodeProperties componentInChildren = val3.GetComponentInChildren<ScanNodeProperties>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.scrapValue = num;
				componentInChildren.subText = $"Value: ${num}";
				component2.scrapValue = num;
				UpdateScanNodeServerRpc(new NetworkObjectReference(component), num);
			}
			return new NetworkObjectReference(val3);
		}

		[ServerRpc(RequireOwnership = false)]
		private void UpdateParentServerRpc(NetworkObjectReference netObjRef)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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(1527429956u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1527429956u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					UpdateParentClientRpc(netObjRef);
				}
			}
		}

		[ClientRpc]
		private void UpdateParentClientRpc(NetworkObjectReference netObjRef)
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1686132120u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1686132120u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkObject val3 = default(NetworkObject);
				((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null);
				if ((Object)(object)val3 != (Object)null)
				{
					((Component)val3).transform.parent = StartOfRound.Instance.propsContainer;
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void UpdateScanNodeServerRpc(NetworkObjectReference netObjRef, int value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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(997144913u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
					BytePacker.WriteValueBitPacked(val2, value);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 997144913u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					UpdateScanNodeClientRpc(netObjRef, value);
				}
			}
		}

		[ClientRpc]
		public void UpdateScanNodeClientRpc(NetworkObjectReference netObjRef, int value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1566523076u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				BytePacker.WriteValueBitPacked(val2, value);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1566523076u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				NetworkObject val3 = default(NetworkObject);
				((NetworkObjectReference)(ref netObjRef)).TryGet(ref val3, (NetworkManager)null);
				GrabbableObject val4 = default(GrabbableObject);
				if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.TryGetComponent<GrabbableObject>(ref val4))
				{
					val4.SetScrapValue(value);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_MagicShippingCrate()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3393930415u, new RpcReceiveHandler(__rpc_handler_3393930415));
			NetworkManager.__rpc_func_table.Add(2428105445u, new RpcReceiveHandler(__rpc_handler_2428105445));
			NetworkManager.__rpc_func_table.Add(1527429956u, new RpcReceiveHandler(__rpc_handler_1527429956));
			NetworkManager.__rpc_func_table.Add(1686132120u, new RpcReceiveHandler(__rpc_handler_1686132120));
			NetworkManager.__rpc_func_table.Add(997144913u, new RpcReceiveHandler(__rpc_handler_997144913));
			NetworkManager.__rpc_func_table.Add(1566523076u, new RpcReceiveHandler(__rpc_handler_1566523076));
		}

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

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

		private static void __rpc_handler_1527429956(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MagicShippingCrate)(object)target).UpdateParentServerRpc(netObjRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1686132120(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((MagicShippingCrate)(object)target).UpdateParentClientRpc(netObjRef);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_997144913(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				int value = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref value);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MagicShippingCrate)(object)target).UpdateScanNodeServerRpc(netObjRef, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1566523076(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				NetworkObjectReference netObjRef = default(NetworkObjectReference);
				((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref netObjRef, default(ForNetworkSerializable));
				int value = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref value);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((MagicShippingCrate)(object)target).UpdateScanNodeClientRpc(netObjRef, value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "MagicShippingCrate";
		}
	}
	public class MagicShippingCrateHandler : ContentHandler<MagicShippingCrateHandler>
	{
		public DefaultBundle? defaultBundle;

		public MagicShippingCrateHandler(CRMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<DefaultBundle>("magicshippingcrateassets", ref defaultBundle, false);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace com.github.xuuxiaolan.mzcomagicshipping.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}