Decompiled source of LunarConstructor v1.1.0

LunarConstructor.dll

Decompiled 3 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.Projectile;
using R2API;
using RoR2;
using RoR2.Audio;
using RoR2.Hologram;
using RoR2.Projectile;
using ShaderSwapper;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyCompany("LunarConstructor")]
[assembly: AssemblyProduct("LunarConstructor")]
[assembly: AssemblyTitle("LunarConstructor")]
[assembly: AssemblyInformationalVersion("1.0.0+57a5fd3f5b7771a9971c4662098712c06a558f8f")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LunarConstructor
{
	public class ConstructorCostHologramContent : MonoBehaviour
	{
		public string displayValue;

		public TextMeshPro targetTextMesh;

		private string oldDisplayValue;

		public Color colorValue;

		private Color oldColorValue;

		private void FixedUpdate()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)targetTextMesh) && (displayValue != oldDisplayValue || colorValue != oldColorValue))
			{
				oldDisplayValue = displayValue;
				oldColorValue = colorValue;
				((TMP_Text)targetTextMesh).SetText(displayValue, true);
				((Graphic)targetTextMesh).color = colorValue;
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("acanthi.LunarConstructor", "LunarConstructor", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class LunarConstructor : BaseUnityPlugin
	{
		public const string PluginGUID = "acanthi.LunarConstructor";

		public const string PluginAuthor = "acanthi";

		public const string PluginName = "LunarConstructor";

		public const string PluginVersion = "1.0.0";

		private Material constructorMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/bazaar/matBazaarCauldron.mat").WaitForCompletion();

		private Material waterMat = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/bazaar/matBazaarRedWhiteLiquid.mat").WaitForCompletion();

		public static GameObject lunarConstructorPrefab;

		public static AssetBundle LunarConstructorAssets;

		public static GameObject ConstructorHologramContent;

		public GameObject ConstructorCostHologramContentPrefab()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/CostHologramContent.prefab").WaitForCompletion(), "CustomCostHologramContentPrefab", false);
			Object.DestroyImmediate((Object)(object)val.GetComponent<CostHologramContent>());
			ConstructorCostHologramContent constructorCostHologramContent = val.AddComponent<ConstructorCostHologramContent>();
			constructorCostHologramContent.targetTextMesh = ((Component)val.transform.Find("Text")).GetComponent<TextMeshPro>();
			return val;
		}

		private void Awake()
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("LunarConstructor.lunarconstructor_assets"))
			{
				LunarConstructorAssets = AssetBundle.LoadFromStream(stream);
			}
			((MonoBehaviour)this).StartCoroutine(ShaderSwapper.UpgradeStubbedShadersAsync(LunarConstructorAssets));
			CreatePrefab();
			Stage.onStageStartGlobal += Stage_onStageStartGlobal;
			PurchaseInteraction.GetInteractability += new hook_GetInteractability(LunarConstructor_GetInteractability);
			TinkerProjectile.TransmuteTargetObject += new hook_TransmuteTargetObject(TinkerProjectile_TransmuteTargetObject);
			ConstructorHologramContent = ConstructorCostHologramContentPrefab();
		}

		private void TinkerProjectile_TransmuteTargetObject(orig_TransmuteTargetObject orig, TinkerProjectile self, GameObject targetObject)
		{
			TinkerableObjectAttributes val = default(TinkerableObjectAttributes);
			ConstructorManager constructorManager = default(ConstructorManager);
			if (!targetObject.TryGetComponent<TinkerableObjectAttributes>(ref val))
			{
				orig.Invoke(self, targetObject);
			}
			else if (!val.IsTinkerable)
			{
				orig.Invoke(self, targetObject);
			}
			else if (targetObject.TryGetComponent<ConstructorManager>(ref constructorManager))
			{
				constructorManager.RollItemsServer();
				orig.Invoke(self, targetObject);
			}
			else
			{
				orig.Invoke(self, targetObject);
			}
		}

		private Interactability LunarConstructor_GetInteractability(orig_GetInteractability orig, PurchaseInteraction self, Interactor activator)
		{
			//IL_0046: 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_004f: 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)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			ConstructorManager constructorManager = default(ConstructorManager);
			if (((Component)self).TryGetComponent<ConstructorManager>(ref constructorManager))
			{
				CharacterBody component = ((Component)activator).GetComponent<CharacterBody>();
				if (Object.op_Implicit((Object)(object)component) && (Object)(object)constructorManager.GetBodyHighestScrap(component) != (Object)null)
				{
					return orig.Invoke(self, activator);
				}
				return (Interactability)1;
			}
			return orig.Invoke(self, activator);
		}

		public static void Stage_onStageStartGlobal(Stage stage)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_005e: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			string name = ((Scene)(ref activeScene)).name;
			string text = name;
			if (!(text == "bazaar"))
			{
				if (text == "moon2")
				{
					SpawnLunarConstructor(new Vector3(-232.915f, -186.8033f, -323.1316f), Quaternion.Euler(0f, 64f, 0f));
				}
			}
			else
			{
				SpawnLunarConstructor(new Vector3(-117.5476f, -23.2836f, -7.2528f), Quaternion.Euler(0f, 135f, 0f));
			}
		}

		public static void SpawnLunarConstructor(Vector3 pos, Quaternion rot)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(lunarConstructorPrefab, pos, rot);
			NetworkServer.Spawn(val);
		}

		private void CreatePrefab()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Expected O, but got Unknown
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Expected O, but got Unknown
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Expected O, but got Unknown
			lunarConstructorPrefab = PrefabAPI.InstantiateClone(LunarConstructorAssets.LoadAsset<GameObject>("lunarconstructor.fbx"), "lunarConstructor");
			((Object)lunarConstructorPrefab).name = "LunarConstructor";
			lunarConstructorPrefab.AddComponent<NetworkIdentity>();
			lunarConstructorPrefab.transform.localScale = new Vector3(1.5f, 1.5f, 1.5f);
			((Renderer)((Component)lunarConstructorPrefab.transform.GetChild(1)).GetComponent<MeshRenderer>()).sharedMaterial = constructorMat;
			((Component)lunarConstructorPrefab.transform.GetChild(1)).gameObject.AddComponent<BoxCollider>();
			((Component)lunarConstructorPrefab.transform.GetChild(1)).transform.rotation = Quaternion.Euler(270f, 90f, 0f);
			((Component)lunarConstructorPrefab.transform.GetChild(1)).transform.localScale = new Vector3(150f, 150f, 115f);
			((Component)lunarConstructorPrefab.transform.GetChild(1)).transform.localPosition = new Vector3(0f, -1f, 0f);
			((Component)lunarConstructorPrefab.transform.GetChild(0)).transform.localScale = new Vector3(150f, 150f, 115f);
			((Component)lunarConstructorPrefab.transform.GetChild(0)).transform.localPosition = new Vector3(0f, 0f, 0f);
			((Renderer)((Component)lunarConstructorPrefab.transform.GetChild(0)).GetComponent<MeshRenderer>()).sharedMaterial = waterMat;
			((Component)lunarConstructorPrefab.transform.GetChild(0)).gameObject.AddComponent<Light>().color = Color.white;
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/bazaar/Bazaar_LunarInfectionLarge.prefab").WaitForCompletion();
			GameObject val2 = PrefabAPI.InstantiateClone(val, "lunarConstructorShards");
			val2.transform.parent = lunarConstructorPrefab.transform;
			val2.transform.localPosition = new Vector3(0f, -1f, 0f);
			val2.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
			GameObject val3 = new GameObject("PickupDisplay", new Type[2]
			{
				typeof(PickupDisplay),
				typeof(Highlight)
			});
			val3.transform.parent = lunarConstructorPrefab.transform;
			val3.transform.localPosition = new Vector3(0f, 1.65f, -0.75f);
			GameObject val4 = new GameObject("Hologram", new Type[1] { typeof(HologramProjector) });
			val4.transform.parent = lunarConstructorPrefab.transform;
			val4.transform.localPosition = new Vector3(0f, -0.2f, 0.9f);
			val4.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
			ConstructorManager constructorManager = lunarConstructorPrefab.AddComponent<ConstructorManager>();
			TinkerableObjectAttributes val5 = lunarConstructorPrefab.AddComponent<TinkerableObjectAttributes>();
			PurchaseInteraction val6 = lunarConstructorPrefab.AddComponent<PurchaseInteraction>();
			val6.contextToken = "Construct Item (1 Scrap)";
			val6.NetworkdisplayNameToken = "Lunar Constructor";
			constructorManager.purchaseInteraction = val6;
			lunarConstructorPrefab.GetComponent<Highlight>().targetRenderer = (Renderer)(object)((Component)lunarConstructorPrefab.transform.GetChild(1)).GetComponent<MeshRenderer>();
			GameObject val7 = new GameObject();
			GameObject val8 = Object.Instantiate<GameObject>(val7, lunarConstructorPrefab.transform);
			((Collider)val8.AddComponent<BoxCollider>()).isTrigger = true;
			val8.AddComponent<EntityLocator>().entity = lunarConstructorPrefab;
			PrefabAPI.RegisterNetworkPrefab(lunarConstructorPrefab);
		}
	}
	public class ConstructorManager : NetworkBehaviour, IHologramContentProvider
	{
		public PurchaseInteraction purchaseInteraction;

		public PickupDisplay pickupDisplay;

		public HologramProjector hologram;

		public Highlight highlight;

		private GameObject shrineUseEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/VFX/ShrineUseEffect.prefab").WaitForCompletion();

		private GameObject lunarRerollEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/LunarRecycler/LunarRerollEffect.prefab").WaitForCompletion();

		private ItemTag bannedItemTag = (ItemTag)15;

		private float refreshTimer;

		private const float refreshDuration = 1.5f;

		private bool waitingForRefresh;

		private UniquePickup refreshPrintItem;

		[SyncVar]
		private int whitePickupIndex = -1;

		[SyncVar]
		private int greenPickupIndex = -1;

		[SyncVar]
		private int redPickupIndex = -1;

		[SyncVar]
		private int yellowPickupIndex = -1;

		private int currentPickupTierIndex;

		[SyncVar]
		private GameObject closestPlayerObject;

		private NetworkInstanceId ___closestPlayerObjectNetId;

		private static int kRpcRpcClearPickup;

		private PickupIndex whitePickup
		{
			get
			{
				//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_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				_ = whitePickupIndex;
				if (whitePickupIndex < 0)
				{
					return PickupIndex.none;
				}
				return new PickupIndex(whitePickupIndex);
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				NetworkwhitePickupIndex = value.value;
			}
		}

		private PickupIndex greenPickup
		{
			get
			{
				//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_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				_ = greenPickupIndex;
				if (greenPickupIndex < 0)
				{
					return PickupIndex.none;
				}
				return new PickupIndex(greenPickupIndex);
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				NetworkgreenPickupIndex = value.value;
			}
		}

		private PickupIndex redPickup
		{
			get
			{
				//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_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				_ = redPickupIndex;
				if (redPickupIndex < 0)
				{
					return PickupIndex.none;
				}
				return new PickupIndex(redPickupIndex);
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				NetworkredPickupIndex = value.value;
			}
		}

		private PickupIndex yellowPickup
		{
			get
			{
				//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_0016: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				_ = yellowPickupIndex;
				if (yellowPickupIndex < 0)
				{
					return PickupIndex.none;
				}
				return new PickupIndex(yellowPickupIndex);
			}
			set
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				NetworkyellowPickupIndex = value.value;
			}
		}

		private CharacterBody closestPlayer
		{
			get
			{
				return Object.op_Implicit((Object)(object)closestPlayerObject) ? closestPlayerObject.GetComponent<CharacterBody>() : null;
			}
			set
			{
				NetworkclosestPlayerObject = (Object.op_Implicit((Object)(object)value) ? ((Component)value).gameObject : null);
			}
		}

		public int NetworkwhitePickupIndex
		{
			get
			{
				return whitePickupIndex;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<int>(value, ref whitePickupIndex, 1u);
			}
		}

		public int NetworkgreenPickupIndex
		{
			get
			{
				return greenPickupIndex;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<int>(value, ref greenPickupIndex, 2u);
			}
		}

		public int NetworkredPickupIndex
		{
			get
			{
				return redPickupIndex;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<int>(value, ref redPickupIndex, 4u);
			}
		}

		public int NetworkyellowPickupIndex
		{
			get
			{
				return yellowPickupIndex;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<int>(value, ref yellowPickupIndex, 8u);
			}
		}

		public GameObject NetworkclosestPlayerObject
		{
			get
			{
				return closestPlayerObject;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVarGameObject(value, ref closestPlayerObject, 16u, ref ___closestPlayerObjectNetId);
			}
		}

		public void Start()
		{
			//IL_007f: 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)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)pickupDisplay) && !Object.op_Implicit((Object)(object)highlight) && !Object.op_Implicit((Object)(object)hologram))
			{
				pickupDisplay = ((Component)((Component)this).transform.Find("PickupDisplay")).GetComponent<PickupDisplay>();
				highlight = ((Component)((Component)this).transform.Find("PickupDisplay")).GetComponent<Highlight>();
				pickupDisplay.highlight = highlight;
				highlight.highlightColor = (HighlightColor)2;
				hologram = ((Component)((Component)this).transform.Find("Hologram")).GetComponent<HologramProjector>();
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance))
			{
				purchaseInteraction.SetAvailable(true);
				RollItemsServer();
			}
			((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)OnPurchase);
			refreshPrintItem = UniquePickup.none;
			hologram.contentProvider = (IHologramContentProvider)(object)this;
			hologram.disableHologramRotation = true;
		}

		[Server]
		public void RollItemsServer()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: 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_0043: 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_005f: 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_007b: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void LunarConstructor.ConstructorManager::RollItemsServer()' called on client");
				return;
			}
			whitePickup = PickFromList(Run.instance.availableTier1DropList).pickupIndex;
			greenPickup = PickFromList(Run.instance.availableTier2DropList).pickupIndex;
			redPickup = PickFromList(Run.instance.availableTier3DropList).pickupIndex;
			yellowPickup = PickFromList(Run.instance.availableBossDropList).pickupIndex;
			CallRpcClearPickup();
		}

		[ClientRpc]
		public void RpcClearPickup()
		{
			pickupDisplay.SetPickup(ref UniquePickup.none, false);
		}

		public void FixedUpdate()
		{
			//IL_0079: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: 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_00a9: 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_00b8: 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_00cf: 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)
			if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance))
			{
				closestPlayer = GetClosestPlayerWithScrapServer();
			}
			UpdateDisplayClient();
			if (!waitingForRefresh)
			{
				return;
			}
			refreshTimer -= Time.fixedDeltaTime;
			if (refreshTimer <= 0f)
			{
				purchaseInteraction.SetAvailable(true);
				waitingForRefresh = false;
				if (refreshPrintItem != UniquePickup.none)
				{
					PickupDropletController.CreatePickupDroplet(refreshPrintItem, ((Component)this).transform.position, (((Component)this).transform.forward + Vector3.up + Vector3.up) * 8f, true);
					refreshPrintItem = UniquePickup.none;
				}
			}
		}

		public void UpdateDisplayClient()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: 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_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_009f: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected I4, but got Unknown
			//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)pickupDisplay) || whitePickup == PickupIndex.none || greenPickup == PickupIndex.none || redPickup == PickupIndex.none || yellowPickup == PickupIndex.none)
			{
				return;
			}
			if (!(pickupDisplay.GetPickupIndex() == PickupIndex.none))
			{
				pickupDisplay.GetPickupIndex();
				if (0 == 0)
				{
					goto IL_00d6;
				}
			}
			PickupDisplay obj = pickupDisplay;
			UniquePickup val = new UniquePickup(whitePickup);
			obj.SetPickup(ref val, false);
			if (currentPickupTierIndex != 1)
			{
				DisplayRerollEffectClient();
			}
			currentPickupTierIndex = 1;
			goto IL_00d6;
			IL_00d6:
			if (!Object.op_Implicit((Object)(object)closestPlayer) || (Object)(object)GetBodyHighestScrap(closestPlayer) == (Object)null)
			{
				return;
			}
			ItemTier tier = GetBodyHighestScrap(closestPlayer).tier;
			ItemTier val2 = tier;
			switch (val2 - 1)
			{
			case 3:
			{
				PickupDisplay obj4 = pickupDisplay;
				val = new UniquePickup(yellowPickup);
				obj4.SetPickup(ref val, false);
				if (currentPickupTierIndex != 4)
				{
					DisplayRerollEffectClient();
				}
				currentPickupTierIndex = 4;
				break;
			}
			case 1:
			{
				PickupDisplay obj3 = pickupDisplay;
				val = new UniquePickup(redPickup);
				obj3.SetPickup(ref val, false);
				if (currentPickupTierIndex != 3)
				{
					DisplayRerollEffectClient();
				}
				currentPickupTierIndex = 3;
				break;
			}
			case 0:
			{
				PickupDisplay obj5 = pickupDisplay;
				val = new UniquePickup(greenPickup);
				obj5.SetPickup(ref val, false);
				if (currentPickupTierIndex != 2)
				{
					DisplayRerollEffectClient();
				}
				currentPickupTierIndex = 2;
				break;
			}
			default:
			{
				PickupDisplay obj2 = pickupDisplay;
				val = new UniquePickup(whitePickup);
				obj2.SetPickup(ref val, false);
				if (currentPickupTierIndex != 1)
				{
					DisplayRerollEffectClient();
				}
				currentPickupTierIndex = 1;
				break;
			}
			}
		}

		public void DisplayRerollEffectClient()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			EffectManager.SpawnEffect(lunarRerollEffect, new EffectData
			{
				origin = ((Component)pickupDisplay).transform.position,
				rotation = Quaternion.identity,
				scale = 2f
			}, true);
		}

		public ItemDef GetBodyHighestScrap(CharacterBody body)
		{
			ItemTier tier;
			return GetBodyHighestScrap(body, out tier);
		}

		public ItemDef GetBodyHighestScrap(CharacterBody body, out ItemTier tier)
		{
			if ((Object)(object)body == (Object)null)
			{
				tier = (ItemTier)5;
				return null;
			}
			Inventory inventory = body.inventory;
			if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)inventory))
			{
				if (inventory.GetItemCountPermanent(Items.ScrapYellow) > 0)
				{
					tier = (ItemTier)4;
					return Items.ScrapYellow;
				}
				if (inventory.GetItemCountPermanent(Items.ScrapRedSuppressed) > 0)
				{
					tier = (ItemTier)2;
					return Items.ScrapRedSuppressed;
				}
				if (inventory.GetItemCountPermanent(Items.ScrapRed) > 0)
				{
					tier = (ItemTier)2;
					return Items.ScrapRed;
				}
				if (inventory.GetItemCountPermanent(Items.RegeneratingScrap) > 0)
				{
					tier = (ItemTier)1;
					return Items.RegeneratingScrap;
				}
				if (inventory.GetItemCountPermanent(Items.ScrapGreenSuppressed) > 0)
				{
					tier = (ItemTier)1;
					return Items.ScrapGreenSuppressed;
				}
				if (inventory.GetItemCountPermanent(Items.ScrapGreen) > 0)
				{
					tier = (ItemTier)1;
					return Items.ScrapGreen;
				}
				if (inventory.GetItemCountPermanent(Items.ScrapWhiteSuppressed) > 0)
				{
					tier = (ItemTier)1;
					return Items.ScrapWhiteSuppressed;
				}
				if (inventory.GetItemCountPermanent(Items.ScrapWhite) > 0)
				{
					tier = (ItemTier)0;
					return Items.ScrapWhite;
				}
			}
			tier = (ItemTier)5;
			return null;
		}

		[Server]
		public CharacterBody GetClosestPlayerServer()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'RoR2.CharacterBody LunarConstructor.ConstructorManager::GetClosestPlayerServer()' called on client");
				return default(CharacterBody);
			}
			if (!NetworkServer.active)
			{
				Debug.Log((object)"GetClosestPlayerServer() called on client!");
			}
			CharacterBody val = null;
			float num = 9999f;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.master.GetBody() == (Object)null))
				{
					float num2 = Vector3.Distance(instance.master.GetBody().transform.position, ((Component)this).transform.position);
					if ((Object)(object)val == (Object)null || num2 < num)
					{
						val = instance.master.GetBody();
						num = num2;
					}
				}
			}
			return val;
		}

		[Server]
		public CharacterBody GetClosestPlayerWithScrapServer()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: 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)
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'RoR2.CharacterBody LunarConstructor.ConstructorManager::GetClosestPlayerWithScrapServer()' called on client");
				return default(CharacterBody);
			}
			if (!NetworkServer.active)
			{
				Debug.Log((object)"GetClosestPlayerServerWithScrap() called on client!");
			}
			CharacterBody val = null;
			float num = 9999f;
			foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
			{
				if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.master.GetBody() == (Object)null) && !((Object)(object)GetBodyHighestScrap(instance.master.GetBody()) == (Object)null))
				{
					float num2 = Vector3.Distance(instance.master.GetBody().transform.position, ((Component)this).transform.position);
					if ((Object)(object)val == (Object)null || num2 < num)
					{
						val = instance.master.GetBody();
						num = num2;
					}
				}
			}
			return val;
		}

		public bool PassesFilter(PickupIndex pickupIndex)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_002c: 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)
			if ((int)bannedItemTag == 0)
			{
				return true;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex);
			if ((int)pickupDef.itemIndex != -1)
			{
				return !ItemCatalog.GetItemDef(pickupDef.itemIndex).ContainsTag(bannedItemTag);
			}
			return true;
		}

		[Server]
		private UniquePickup PickFromList(List<PickupIndex> dropList)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_007f: 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)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'RoR2.UniquePickup LunarConstructor.ConstructorManager::PickFromList(System.Collections.Generic.List`1<RoR2.PickupIndex>)' called on client");
				return default(UniquePickup);
			}
			if (!NetworkServer.active)
			{
				return UniquePickup.none;
			}
			UniquePickup none = UniquePickup.none;
			if (dropList != null && dropList.Count > 0)
			{
				((UniquePickup)(ref none))..ctor(Run.instance.treasureRng.NextElementUniform<PickupIndex>(dropList.Where(PassesFilter).ToList()));
			}
			return none;
		}

		[Server]
		public void OnPurchase(Interactor interactor)
		{
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Expected O, but got Unknown
			//IL_0074: 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)
			//IL_009c: 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)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_00be: Expected I4, but got Unknown
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void LunarConstructor.ConstructorManager::OnPurchase(RoR2.Interactor)' called on client");
				return;
			}
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'ConstructorManager::OnPurchase(RoR2.Interactor)' called on client");
				return;
			}
			purchaseInteraction.SetAvailable(false);
			waitingForRefresh = true;
			refreshTimer = 1.5f;
			CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>();
			ItemTier scrapTier;
			ItemDef andConsumeItem = GetAndConsumeItem(component, out scrapTier);
			if (Object.op_Implicit((Object)(object)andConsumeItem))
			{
				PurchaseInteraction.CreateItemTakenOrb(component.corePosition, ((Component)this).gameObject, andConsumeItem.itemIndex);
				Util.PlaySound("Play_voidJailer_m1_impact", ((Component)this).gameObject);
				ItemTier val = scrapTier;
				ItemTier val2 = val;
				switch ((int)val2)
				{
				case 4:
					refreshPrintItem = new UniquePickup(yellowPickup);
					break;
				case 2:
					refreshPrintItem = new UniquePickup(redPickup);
					break;
				case 1:
					refreshPrintItem = new UniquePickup(greenPickup);
					break;
				case 0:
					refreshPrintItem = new UniquePickup(whitePickup);
					break;
				default:
					refreshPrintItem = UniquePickup.none;
					break;
				}
			}
			EffectManager.SpawnEffect(shrineUseEffect, new EffectData
			{
				origin = ((Component)this).gameObject.transform.position,
				rotation = Quaternion.identity,
				scale = 3f,
				color = Color32.op_Implicit(Color.cyan)
			}, true);
		}

		private ItemDef GetAndConsumeItem(CharacterBody interactorBody, out ItemTier scrapTier)
		{
			//IL_003a: 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)
			//IL_0043: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected I4, but got Unknown
			//IL_0095: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Expected O, but got Unknown
			ItemTier tier;
			ItemDef bodyHighestScrap = GetBodyHighestScrap(interactorBody, out tier);
			bool flag = false;
			if ((Object)(object)bodyHighestScrap == (Object)null)
			{
				scrapTier = (ItemTier)5;
				return null;
			}
			if ((Object)(object)bodyHighestScrap == (Object)(object)Items.RegeneratingScrap)
			{
				ItemIndex itemIndex = bodyHighestScrap.itemIndex;
				ItemTransformation val = default(ItemTransformation);
				((ItemTransformation)(ref val)).originalItemIndex = itemIndex;
				((ItemTransformation)(ref val)).newItemIndex = (ItemIndex)(-1);
				((ItemTransformation)(ref val)).maxToTransform = 1;
				((ItemTransformation)(ref val)).forbidTempItems = true;
				ItemTransformation val2 = val;
				if (((ItemTransformation)(ref val2)).originalItemIndex == Items.RegeneratingScrap.itemIndex)
				{
					flag = true;
					((ItemTransformation)(ref val2)).newItemIndex = Items.RegeneratingScrapConsumed.itemIndex;
				}
				TryTransformResult val3 = default(TryTransformResult);
				((ItemTransformation)(ref val2)).TryTransform(interactorBody.inventory, ref val3);
				if (flag)
				{
					EntitySoundManager.EmitSoundServer(NetworkSoundEventCatalog.FindNetworkSoundEventIndex("Play_item_proc_regenScrap_consume"), ((Component)interactorBody).gameObject);
					ModelLocator component = ((Component)interactorBody).GetComponent<ModelLocator>();
					if (Object.op_Implicit((Object)(object)component))
					{
						Transform modelTransform = component.modelTransform;
						if (Object.op_Implicit((Object)(object)modelTransform))
						{
							CharacterModel component2 = ((Component)modelTransform).GetComponent<CharacterModel>();
							if (Object.op_Implicit((Object)(object)component2))
							{
								List<GameObject> itemDisplayObjects = component2.GetItemDisplayObjects(Items.RegeneratingScrap.itemIndex);
								if (itemDisplayObjects.Count > 0)
								{
									GameObject val4 = itemDisplayObjects[0];
									GameObject val5 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapExplosionDisplay.prefab").WaitForCompletion();
									EffectData val6 = new EffectData
									{
										origin = val4.transform.position,
										rotation = val4.transform.rotation
									};
									EffectManager.SpawnEffect(val5, val6, true);
								}
							}
						}
					}
					EffectManager.SimpleMuzzleFlash(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapExplosionInPrinter.prefab").WaitForCompletion(), ((Component)this).gameObject, "Circle", true);
					CharacterMasterNotificationQueue.SendTransformNotification(interactorBody.master, Items.RegeneratingScrap.itemIndex, Items.RegeneratingScrapConsumed.itemIndex, (TransformationType)0);
				}
			}
			else
			{
				interactorBody.inventory.RemoveItemPermanent(bodyHighestScrap, 1);
			}
			scrapTier = (ItemTier)(int)tier;
			return bodyHighestScrap;
		}

		public bool ShouldDisplayHologram(GameObject viewer)
		{
			return true;
		}

		public GameObject GetHologramContentPrefab()
		{
			return LunarConstructor.ConstructorHologramContent;
		}

		public void UpdateHologramContent(GameObject hologramContentObject, Transform viewerBody)
		{
			//IL_0046: 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_0059: 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)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_0076: 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)
			//IL_0085: 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_0092: 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)
			ConstructorCostHologramContent component = hologramContentObject.GetComponent<ConstructorCostHologramContent>();
			if (Object.op_Implicit((Object)(object)component))
			{
				component.displayValue = "1 Scrap";
				switch (currentPickupTierIndex)
				{
				case 1:
					component.colorValue = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)1));
					break;
				case 2:
					component.colorValue = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)2));
					break;
				case 3:
					component.colorValue = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)3));
					break;
				case 4:
					component.colorValue = Color32.op_Implicit(ColorCatalog.GetColor((ColorIndex)13));
					break;
				default:
					component.colorValue = Color.white;
					break;
				}
			}
		}

		private void UNetVersion()
		{
		}

		protected static void InvokeRpcRpcClearPickup(NetworkBehaviour obj, NetworkReader reader)
		{
			if (!NetworkClient.active)
			{
				Debug.LogError((object)"RPC RpcClearPickup called on server.");
			}
			else
			{
				((ConstructorManager)(object)obj).RpcClearPickup();
			}
		}

		public void CallRpcClearPickup()
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				Debug.LogError((object)"RPC Function RpcClearPickup called on client.");
				return;
			}
			NetworkWriter val = new NetworkWriter();
			val.Write((short)0);
			val.Write((short)2);
			val.WritePackedUInt32((uint)kRpcRpcClearPickup);
			val.Write(((Component)this).GetComponent<NetworkIdentity>().netId);
			((NetworkBehaviour)this).SendRPCInternal(val, 0, "RpcClearPickup");
		}

		static ConstructorManager()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			kRpcRpcClearPickup = -1133794592;
			NetworkBehaviour.RegisterRpcDelegate(typeof(ConstructorManager), kRpcRpcClearPickup, new CmdDelegate(InvokeRpcRpcClearPickup));
			NetworkCRC.RegisterBehaviour("ConstructorManager", 0);
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			if (forceAll)
			{
				writer.WritePackedUInt32((uint)whitePickupIndex);
				writer.WritePackedUInt32((uint)greenPickupIndex);
				writer.WritePackedUInt32((uint)redPickupIndex);
				writer.WritePackedUInt32((uint)yellowPickupIndex);
				writer.Write(closestPlayerObject);
				return true;
			}
			bool flag = false;
			if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.WritePackedUInt32((uint)whitePickupIndex);
			}
			if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.WritePackedUInt32((uint)greenPickupIndex);
			}
			if ((((NetworkBehaviour)this).syncVarDirtyBits & 4u) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.WritePackedUInt32((uint)redPickupIndex);
			}
			if ((((NetworkBehaviour)this).syncVarDirtyBits & 8u) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.WritePackedUInt32((uint)yellowPickupIndex);
			}
			if ((((NetworkBehaviour)this).syncVarDirtyBits & 0x10u) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.Write(closestPlayerObject);
			}
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
			}
			return flag;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			//IL_0038: 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)
			if (initialState)
			{
				whitePickupIndex = (int)reader.ReadPackedUInt32();
				greenPickupIndex = (int)reader.ReadPackedUInt32();
				redPickupIndex = (int)reader.ReadPackedUInt32();
				yellowPickupIndex = (int)reader.ReadPackedUInt32();
				___closestPlayerObjectNetId = reader.ReadNetworkId();
				return;
			}
			int num = (int)reader.ReadPackedUInt32();
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				whitePickupIndex = (int)reader.ReadPackedUInt32();
			}
			if (((uint)num & 2u) != 0)
			{
				greenPickupIndex = (int)reader.ReadPackedUInt32();
			}
			if (((uint)num & 4u) != 0)
			{
				redPickupIndex = (int)reader.ReadPackedUInt32();
			}
			if (((uint)num & 8u) != 0)
			{
				yellowPickupIndex = (int)reader.ReadPackedUInt32();
			}
			if (((uint)num & 0x10u) != 0)
			{
				closestPlayerObject = reader.ReadGameObject();
			}
		}

		public override void PreStartClient()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if (!((NetworkInstanceId)(ref ___closestPlayerObjectNetId)).IsEmpty())
			{
				NetworkclosestPlayerObject = ClientScene.FindLocalObject(___closestPlayerObjectNetId);
			}
		}
	}
}