Decompiled source of ScrantonRealityAnchor v1.0.1

plugins/ScrantonRealityAnchor/ScrantonRealityAnchor.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using ScrantonRealityAnchor.Behaviours;
using ScrantonRealityAnchor.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ScrantonRealityAnchor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3139fb9820a499ad1912e4d0408e66a81ffc02d7")]
[assembly: AssemblyProduct("adds the Scranton Reality Anchor as an item")]
[assembly: AssemblyTitle("ScrantonRealityAnchor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ScrantonRealityAnchor
{
	[BepInPlugin("com.elmish.lethalcompany.scrantonrealityanchor", "ScrantonRealityAnchor", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger;

		public static Item SRAItemProps;

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin ScrantonRealityAnchor is loaded!");
			LoadItem();
			NetworkPatch();
		}

		private void NetworkPatch()
		{
			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);
					}
				}
			}
		}

		public void LoadItem()
		{
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ScrantonRealityAnchor.Resources.anchorassets"))
			{
				AssetBundle val = AssetBundle.LoadFromStream(stream);
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogError((object)"SRA Bundle is null");
					return;
				}
				SRAItemProps = val.LoadAsset<Item>("SRAprops");
				SRAItem sRAItem = SRAItemProps.spawnPrefab.AddComponent<SRAItem>();
				((GrabbableObject)sRAItem).itemProperties = SRAItemProps;
				((GrabbableObject)sRAItem).grabbable = true;
				((GrabbableObject)sRAItem).grabbableToEnemies = false;
				sRAItem.activeSFX = val.LoadAsset<AudioClip>("active hum");
				sRAItem.SRA_AudioSource = ((Component)sRAItem).gameObject.GetComponent<AudioSource>();
				sRAItem.SRA_AudioSource.spatialize = true;
			}
			Utilities.FixMixerGroups(SRAItemProps.spawnPrefab);
			TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>();
			val2.clearPreviousText = true;
			val2.displayText = "???";
			Items.RegisterShopItem(SRAItemProps, 1000);
			NetworkPrefabs.RegisterNetworkPrefab(SRAItemProps.spawnPrefab);
		}
	}
	public static class MyPluginInfo
	{
		public const string GUID = "com.elmish.lethalcompany.scrantonrealityanchor";

		public const string Name = "ScrantonRealityAnchor";

		public const string Version = "1.0.0";
	}
}
namespace ScrantonRealityAnchor.Behaviours
{
	public class SRAItem : GrabbableObject
	{
		public float radius = 11.25f;

		public bool itemActive;

		public bool itemDiscarded;

		public AudioSource SRA_AudioSource;

		public AudioSource SRA_LoopingAudioSource;

		public Collider[] objectsInRange;

		public List<EnemyAI> enemyAIinRange;

		public Collider[] objectsNearRange;

		public List<EnemyAI> enemyAINearRange;

		public int SRALayerMask = 1084754248;

		public GameObject outerGlow;

		public GameObject innerGlow;

		public GameObject bottomSpinningObject;

		public GameObject topSpinningObject;

		public AudioClip activeSFX;

		public override void Start()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			((GrabbableObject)this).Start();
			base.insertedBattery = new Battery(false, 1f);
			outerGlow = ((Component)((Component)this).transform.Find("glow")).gameObject;
			innerGlow = ((Component)((Component)this).transform.Find("innerGlow")).gameObject;
			bottomSpinningObject = ((Component)((Component)this).transform.Find("bottom half model/spinning base")).gameObject;
			topSpinningObject = ((Component)((Component)this).transform.Find("top half model/spinning base")).gameObject;
			SRA_LoopingAudioSource = innerGlow.GetComponent<AudioSource>();
			SRA_LoopingAudioSource.spatialize = true;
			InvertNormals(((Component)outerGlow.transform.GetChild(0)).gameObject);
		}

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

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			DropItemServerRpc();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if (!((Object)(object)base.playerHeldBy == (Object)null) && buttonDown)
			{
				ActivateItemServerRpc(!itemActive);
			}
		}

		public void FixedUpdate()
		{
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			if (!itemActive)
			{
				return;
			}
			bottomSpinningObject.transform.Rotate(0f, 2f, 0f);
			topSpinningObject.transform.Rotate(0f, 2f, 0f);
			if (!itemDiscarded)
			{
				return;
			}
			bottomSpinningObject.transform.Rotate(0f, 6f, 0f);
			topSpinningObject.transform.Rotate(0f, 6f, 0f);
			objectsInRange = Physics.OverlapSphere(innerGlow.transform.position, radius, SRALayerMask);
			enemyAIinRange = new List<EnemyAI>();
			for (int i = 0; i < objectsInRange.Length - 1; i++)
			{
				EnemyAI component = ((Component)((Component)objectsInRange[i]).transform).GetComponent<EnemyAI>();
				EnemyAICollisionDetect component2 = ((Component)((Component)objectsInRange[i]).transform).GetComponent<EnemyAICollisionDetect>();
				if ((Object)(object)component != (Object)null)
				{
					enemyAIinRange.Add(component);
				}
				else if ((Object)(object)component2 != (Object)null && (Object)(object)component != (Object)(object)component2)
				{
					enemyAIinRange.Add(component2.mainScript);
				}
			}
			objectsNearRange = Physics.OverlapSphere(innerGlow.transform.position, radius + 5f, SRALayerMask);
			enemyAINearRange = new List<EnemyAI>();
			for (int j = 0; j < objectsNearRange.Length - 1; j++)
			{
				EnemyAI component3 = ((Component)((Component)objectsNearRange[j]).transform).GetComponent<EnemyAI>();
				EnemyAICollisionDetect component4 = ((Component)((Component)objectsNearRange[j]).transform).GetComponent<EnemyAICollisionDetect>();
				if ((Object)(object)component3 != (Object)null)
				{
					enemyAINearRange.Add(component3);
				}
				else if ((Object)(object)component4 != (Object)null && (Object)(object)component3 != (Object)(object)component4)
				{
					enemyAINearRange.Add(component4.mainScript);
				}
			}
		}

		public override void Update()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (!itemActive || !itemDiscarded)
			{
				return;
			}
			foreach (EnemyAI item in enemyAINearRange)
			{
				Plugin.Logger.LogMessage((object)$"enemy {((Object)item).name} moving at vel: {item.agent.velocity} with desired vel: {item.agent.desiredVelocity}");
			}
			foreach (EnemyAI item2 in enemyAIinRange)
			{
				Vector3 desiredVelocity = item2.agent.desiredVelocity;
				Vector3 velocity = desiredVelocity / 2f;
				item2.agent.velocity = velocity;
				Plugin.Logger.LogMessage((object)("set velocity and speed of " + ((Object)item2).name));
			}
		}

		public void ToggleItem(bool toggle)
		{
			innerGlow.SetActive(toggle);
			itemActive = toggle;
			if (toggle)
			{
				SRA_LoopingAudioSource.Play();
			}
			else
			{
				SRA_LoopingAudioSource.Stop();
			}
		}

		public void OnDropItem()
		{
			itemDiscarded = true;
			if (itemActive)
			{
				outerGlow.SetActive(true);
				((MonoBehaviour)this).StartCoroutine(ExpandOuterGlow());
			}
		}

		public void OnGrabItem()
		{
			itemDiscarded = false;
			if (outerGlow.activeSelf)
			{
				outerGlow.SetActive(false);
			}
		}

		public IEnumerator ExpandOuterGlow()
		{
			for (int i = 0; i < 38; i++)
			{
				outerGlow.transform.localScale = Vector3.one + Vector3.one * (float)i * 2f;
				yield return (object)new WaitForFixedUpdate();
			}
		}

		public void InvertNormals(GameObject obj)
		{
			//IL_0031: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			MeshFilter component = obj.GetComponent<MeshFilter>();
			if ((Object)(object)component != (Object)null)
			{
				Mesh mesh = component.mesh;
				Vector3[] normals = mesh.normals;
				for (int i = 0; i < normals.Length; i++)
				{
					normals[i] = -normals[i];
				}
				mesh.normals = normals;
				for (int j = 0; j < mesh.subMeshCount; j++)
				{
					int[] triangles = mesh.GetTriangles(j);
					for (int k = 0; k < triangles.Length; k += 3)
					{
						int num = triangles[k];
						triangles[k] = triangles[k + 1];
						triangles[k + 1] = num;
					}
					mesh.SetTriangles(triangles, j);
				}
			}
			else
			{
				Plugin.Logger.LogError((object)("MeshFilter not found on '" + ((Object)obj).name + "'."));
			}
		}

		[ServerRpc]
		public void ActivateItemServerRpc(bool toggle)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(81794889u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref toggle, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 81794889u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ActivateItemClientRpc(toggle);
			}
		}

		[ClientRpc]
		public void ActivateItemClientRpc(bool toggle)
		{
			//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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2140764922u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref toggle, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2140764922u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					ToggleItem(toggle);
				}
			}
		}

		[ServerRpc]
		public void DropItemServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(122935418u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 122935418u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				DropItemClientRpc();
			}
		}

		[ClientRpc]
		public void DropItemClientRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(178321758u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 178321758u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					OnDropItem();
				}
			}
		}

		[ServerRpc]
		public void GrabItemServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Invalid comparison between Unknown and I4
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: 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_0084: Invalid comparison between Unknown and I4
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
				{
					if ((int)networkManager.LogLevel <= 1)
					{
						Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
					}
					return;
				}
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1038208267u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1038208267u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				GrabItemClientRpc();
			}
		}

		[ClientRpc]
		public void GrabItemClientRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2860962959u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2860962959u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					OnGrabItem();
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_SRAItem()
		{
			//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(81794889u, new RpcReceiveHandler(__rpc_handler_81794889));
			NetworkManager.__rpc_func_table.Add(2140764922u, new RpcReceiveHandler(__rpc_handler_2140764922));
			NetworkManager.__rpc_func_table.Add(122935418u, new RpcReceiveHandler(__rpc_handler_122935418));
			NetworkManager.__rpc_func_table.Add(178321758u, new RpcReceiveHandler(__rpc_handler_178321758));
			NetworkManager.__rpc_func_table.Add(1038208267u, new RpcReceiveHandler(__rpc_handler_1038208267));
			NetworkManager.__rpc_func_table.Add(2860962959u, new RpcReceiveHandler(__rpc_handler_2860962959));
		}

		private static void __rpc_handler_81794889(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				bool toggle = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref toggle, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SRAItem)(object)target).ActivateItemServerRpc(toggle);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2140764922(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 toggle = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref toggle, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((SRAItem)(object)target).ActivateItemClientRpc(toggle);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_122935418(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SRAItem)(object)target).DropItemServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_178321758(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)2;
				((SRAItem)(object)target).DropItemClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1038208267(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0076: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Invalid comparison between Unknown and I4
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
			{
				if ((int)networkManager.LogLevel <= 1)
				{
					Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
				}
			}
			else
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((SRAItem)(object)target).GrabItemServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2860962959(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)2;
				((SRAItem)(object)target).GrabItemClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

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