Decompiled source of LunarConstructor v1.2.0

LunarConstructor.dll

Decompiled 19 hours 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.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HG;
using HG.Reflection;
using Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.Projectile;
using R2API;
using RoR2;
using RoR2.Audio;
using RoR2.ExpansionManagement;
using RoR2.Hologram;
using RoR2.Orbs;
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: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LunarConstructor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+8060d02dfe38956266721b8ee3e2bd748c218451")]
[assembly: AssemblyProduct("LunarConstructor")]
[assembly: AssemblyTitle("LunarConstructor")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 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.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("acanthi.LunarConstructor", "LunarConstructor", "1.0.0")]
	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 ExpansionDef voidDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion();

		public static ExpansionDef alloyedDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC3/DLC3.asset").WaitForCompletion();

		public static ExpansionDef hallowedDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC4/DLC4.asset").WaitForCompletion();

		public static GameObject lunarConstructorPrefab;

		public static AssetBundle LunarConstructorAssets;

		public static GameObject ConstructorHologramContent;

		public static ConfigEntry<float> chanceForAccident;

		public static ConfigEntry<float> tempWeight;

		public static ConfigEntry<float> lunarWeight;

		public static ConfigEntry<float> hexWeight;

		public static ConfigEntry<float> voidWeight;

		public static ConfigEntry<float> nothingWeight;

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

		private void InitConfig()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Expected O, but got Unknown
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Expected O, but got Unknown
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Expected O, but got Unknown
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Expected O, but got Unknown
			chanceForAccident = ((BaseUnityPlugin)this).Config.Bind<float>("Unstable Creation", "Unstable Creation Chance", 10f, new ConfigDescription("Chance for an Unstable Creation to occur. (10 = 10%)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			tempWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Unstable Creation", "Temporary Creation Weight", 50f, new ConfigDescription("Chance for an Temporary Creation to occur. (10 = 10%)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			lunarWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Unstable Creation", "Lunar Creation Weight", 25f, new ConfigDescription("Chance for an Lunar Creation to occur. (10 = 10%)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			hexWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Unstable Creation", "Hex Creation Weight", 20f, new ConfigDescription("Chance for an Hex Creation to occur. (10 = 10%)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			voidWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Unstable Creation", "Void Creation Weight", 5f, new ConfigDescription("Chance for a Void Creation to occur. (10 = 10%)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			nothingWeight = ((BaseUnityPlugin)this).Config.Bind<float>("Unstable Creation", "No Creation Weight", 0.5f, new ConfigDescription("Chance for No Creation to occur. (10 = 10%)", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
		}

		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 enum AccidentType
		{
			Lunar,
			Void,
			Temp,
			Hex,
			None
		}

		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;

		private CharacterBody cachedInteractor = null;

		[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 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)
				whitePickupIndex = 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)
				greenPickupIndex = 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)
				redPickupIndex = 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)
				yellowPickupIndex = value.value;
			}
		}

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

		public List<PickupIndex> GetVoidVariantDropTable(ItemTier itemTier)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected I4, but got Unknown
			if (1 == 0)
			{
			}
			List<PickupIndex> result = (int)itemTier switch
			{
				0 => Run.instance.availableVoidTier1DropList, 
				1 => Run.instance.availableVoidTier2DropList, 
				2 => Run.instance.availableVoidTier3DropList, 
				4 => Run.instance.availableVoidBossDropList, 
				_ => Run.instance.availableVoidTier1DropList, 
			};
			if (1 == 0)
			{
			}
			return result;
		}

		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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//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_0045: 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_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			whitePickup = PickFromList(Run.instance.availableTier1DropList).pickupIndex;
			greenPickup = PickFromList(Run.instance.availableTier2DropList).pickupIndex;
			redPickup = PickFromList(Run.instance.availableTier3DropList).pickupIndex;
			yellowPickup = PickFromList(Run.instance.availableBossDropList).pickupIndex;
			RpcClearPickup();
		}

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

		public bool DoAccident(Xoroshiro128Plus rng)
		{
			//IL_00be: 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_00d3: Expected O, but got Unknown
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: 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_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0213: Expected O, but got Unknown
			//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ba: Expected O, but got Unknown
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			WeightedSelection<AccidentType> val = new WeightedSelection<AccidentType>(8);
			val.AddChoice(AccidentType.Lunar, LunarConstructor.lunarWeight.Value);
			val.AddChoice(AccidentType.None, LunarConstructor.nothingWeight.Value);
			if (Run.instance.IsExpansionEnabled(LunarConstructor.alloyedDLC))
			{
				val.AddChoice(AccidentType.Temp, LunarConstructor.tempWeight.Value);
			}
			if (Run.instance.IsExpansionEnabled(LunarConstructor.hallowedDLC))
			{
				val.AddChoice(AccidentType.Hex, LunarConstructor.hexWeight.Value);
			}
			if (Run.instance.IsExpansionEnabled(LunarConstructor.voidDLC))
			{
				val.AddChoice(AccidentType.Void, LunarConstructor.voidWeight.Value);
			}
			switch (val.Evaluate(Run.instance.runRNG.nextNormalizedFloat))
			{
			case AccidentType.Temp:
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cLunarObjective>An unexpected result...</style>"
				});
				refreshPrintItem.decayValue = 1f;
				AttemptGrantPickupDirectly(refreshPrintItem);
				return true;
			case AccidentType.Lunar:
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cLunarObjective>An unexpected result...</style>"
				});
				PickupIndex pickupIndex3 = PickFromList(Run.instance.availableLunarItemDropList).pickupIndex;
				UniquePickup pickup3 = default(UniquePickup);
				((UniquePickup)(ref pickup3))..ctor(pickupIndex3);
				AttemptGrantPickupDirectly(pickup3);
				return true;
			}
			case AccidentType.Hex:
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cLunarObjective>An unexpected result...</style>"
				});
				PickupIndex pickupIndex2 = PickFromList(Run.instance.availableHexTierDropList).pickupIndex;
				UniquePickup pickup2 = default(UniquePickup);
				((UniquePickup)(ref pickup2))..ctor(pickupIndex2);
				AttemptGrantPickupDirectly(pickup2);
				return true;
			}
			case AccidentType.Void:
			{
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cLunarObjective>An unexpected result...</style>"
				});
				ItemTier itemTier = PickupCatalog.GetPickupDef(refreshPrintItem.pickupIndex).itemTier;
				PickupIndex pickupIndex = PickFromList(GetVoidVariantDropTable(itemTier)).pickupIndex;
				UniquePickup pickup = default(UniquePickup);
				((UniquePickup)(ref pickup))..ctor(pickupIndex);
				AttemptGrantPickupDirectly(pickup);
				return true;
			}
			default:
				Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
				{
					baseToken = "<style=cLunarObjective>His laughter echoes in your mind...</style>"
				});
				return false;
			}
		}

		public void FixedUpdate()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: 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_0117: 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_0126: 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))
			{
				return;
			}
			purchaseInteraction.SetAvailable(true);
			waitingForRefresh = false;
			if (!(refreshPrintItem != UniquePickup.none))
			{
				return;
			}
			if (NetworkServer.active && Object.op_Implicit((Object)(object)Run.instance))
			{
				Xoroshiro128Plus treasureRng = Run.instance.treasureRng;
				if (treasureRng.RangeFloat(0f, 100f) <= LunarConstructor.chanceForAccident.Value)
				{
					DoAccident(treasureRng);
				}
				else
				{
					PickupDropletController.CreatePickupDroplet(refreshPrintItem, ((Component)this).transform.position, (((Component)this).transform.forward + Vector3.up + Vector3.up) * 8f, true);
				}
			}
			refreshPrintItem = UniquePickup.none;
		}

		public void AttemptGrantPickupDirectly(UniquePickup pickup)
		{
			//IL_006f: 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_002e: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: 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_004f: 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_005e: 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_0092: Invalid comparison between Unknown and I4
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019a: 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_01a1: 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_00b9: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			if (!NetworkServer.active)
			{
				return;
			}
			CharacterMaster master = cachedInteractor.master;
			if (!Object.op_Implicit((Object)(object)master))
			{
				PickupDropletController.CreatePickupDroplet(pickup, ((Component)this).transform.position, (((Component)this).transform.forward + Vector3.up + Vector3.up) * 8f, true);
				return;
			}
			PickupDef pickupDef = PickupCatalog.GetPickupDef(pickup.pickupIndex);
			if (pickupDef == null)
			{
				return;
			}
			if ((int)pickupDef.itemIndex != -1)
			{
				DispatchArgs val = new DispatchArgs
				{
					inventoryToGrantTo = master.inventory,
					itemIndex = pickupDef.itemIndex,
					origin = ((Component)this).transform.position,
					permanentCount = ((!((UniquePickup)(ref pickup)).isTempItem && !pickup.isRental) ? 1 : 0),
					temporaryCount = (((UniquePickup)(ref pickup)).isTempItem ? 1 : 0),
					rentalCount = (pickup.isRental ? 1 : 0),
					travelDuration = 1f,
					isPickup = true
				};
				NetworkIdentity networkIdentity = cachedInteractor.networkIdentity;
				val.orbDestinationOverride = Either<NetworkIdentity, HurtBox>.op_Implicit(ref networkIdentity);
				ItemTransferOrb.DispatchItemTransferOrb(val);
				return;
			}
			GrantContext val2 = new GrantContext
			{
				body = cachedInteractor,
				controller = null
			};
			((GrantContext)(ref val2)).pickup = pickup;
			val2.position = ((Component)this).transform.position;
			val2.rotation = ((Component)this).transform.rotation;
			GrantContext val3 = val2;
			AttemptGrantDelegate attemptGrant = pickupDef.attemptGrant;
			if (attemptGrant != null)
			{
				attemptGrant.Invoke(ref val3);
			}
			if (Object.op_Implicit((Object)(object)cachedInteractor))
			{
				cachedInteractor.OnPickup((PickupClass)(((UniquePickup)(ref pickup)).isTempItem ? 2 : 3));
			}
			if (val3.shouldNotify)
			{
				GenericPickupController.SendPickupMessage(cachedInteractor.master, pickup);
			}
		}

		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)0;
					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_0079: 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)
			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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			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_001b: Unknown result type (might be due to invalid IL or missing references)
			//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_0062: 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_005f: 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)
			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_0112: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: 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)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Expected O, but got Unknown
			//IL_0066: 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_008e: 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)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected I4, but got Unknown
			//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_00f7: 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_00e4: 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)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: 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_00b9: 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)
			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);
			cachedInteractor = component;
			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;
				}
			}
		}
	}
}