Decompiled source of Lunar Printer v1.0.0

LunarPrinter.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Faust.QoLChests.Configs;
using Faust.QoLChests.Handlers;
using LunarPrinter.Compatibility;
using LunarPrinter.Content;
using LunarScrap.Content;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.Items;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LunarPrinter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LunarPrinter")]
[assembly: AssemblyTitle("LunarPrinter")]
[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 LunarPrinter
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("Geritos.Lunar_Printer", "Lunar_Printer", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class LunarPrinterPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "Geritos.Lunar_Printer";

		public const string PluginAuthor = "Geritos";

		public const string PluginName = "Lunar_Printer";

		public const string PluginVersion = "1.0.0";

		internal static ConfigEntry<int> CreditCost;

		internal static ConfigEntry<int> SelectionWeight;

		public void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			BindConfig();
			LunarPrinter.Content.LunarPrinter.Init();
			LunarPrinter.Content.LunarPrinter.Register();
			ApplyExtensions();
		}

		private void ApplyExtensions()
		{
			if (QoLChestsCompatibility.Enabled)
			{
				QoLChestsCompatibility.RegisterLunarPrinterHighlighting();
			}
		}

		private void BindConfig()
		{
			CreditCost = ((BaseUnityPlugin)this).Config.Bind<int>("Lunar Printer", "Credit Cost", 15, "Credit cost for the director, change this to adjust spawn cost (higher ≈ more rare). The default value is the same as Mili-Tech (Red) Printer on Sky Meadow.");
			SelectionWeight = ((BaseUnityPlugin)this).Config.Bind<int>("Lunar Printer", "Selection Weight", 1, "Selection weight for the director, change this to adjust spawn frequency (lower = more rare). The default value is the same as Mili-Tech (Red) Printer on Sky Meadow.");
		}
	}
}
namespace LunarPrinter.Content
{
	public class LunarDropTable : PickupDropTable
	{
		private readonly List<PickupIndex> _lunarItemPickups = new List<PickupIndex>();

		public override void Regenerate(Run run)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: 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)
			_lunarItemPickups.Clear();
			foreach (PickupIndex availableLunarItemDrop in run.availableLunarItemDropList)
			{
				_lunarItemPickups.Add(availableLunarItemDrop);
			}
		}

		public override int GetPickupCount()
		{
			return _lunarItemPickups.Count;
		}

		public override UniquePickup GeneratePickupPreReplacement(Xoroshiro128Plus rng)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			if (_lunarItemPickups.Count == 0)
			{
				return UniquePickup.none;
			}
			return new UniquePickup(_lunarItemPickups[rng.RangeInt(0, _lunarItemPickups.Count)]);
		}
	}
	public static class LunarItemCostType
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static IsAffordableDelegate <0>__IsAffordable;

			public static PayCostDelegate <1>__PayCost;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_Init <>9__5_0;

			public static Action<List<CostTypeDef>> <>9__7_0;

			internal void <Register>b__5_0(orig_Init orig)
			{
				orig.Invoke();
				ApplyCostTypeIndex();
			}

			internal void <RegisterCostType>b__7_0(List<CostTypeDef> list)
			{
				//IL_0013: 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_002a: 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_003b: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: 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_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Expected O, but got Unknown
				//IL_009b: 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_00ad: Expected O, but got Unknown
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Expected O, but got Unknown
				//IL_00bf: 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_00d0: 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_00db: Expected O, but got Unknown
				//IL_0102: Expected O, but got Unknown
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Expected O, but got Unknown
				<>c__DisplayClass7_0 CS$<>8__locals9 = new <>c__DisplayClass7_0
				{
					baseCostType = CostTypeCatalog.GetCostTypeDef((CostTypeIndex)9)
				};
				CostTypeDef val = new CostTypeDef
				{
					name = "LunarItem",
					itemTier = CS$<>8__locals9.baseCostType.itemTier,
					colorIndex = CS$<>8__locals9.baseCostType.colorIndex,
					costStringFormatToken = CS$<>8__locals9.baseCostType.costStringFormatToken,
					costStringStyle = CS$<>8__locals9.baseCostType.costStringStyle,
					saturateWorldStyledCostString = CS$<>8__locals9.baseCostType.saturateWorldStyledCostString,
					darkenWorldStyledCostString = CS$<>8__locals9.baseCostType.darkenWorldStyledCostString,
					buildCostString = (BuildCostStringDelegate)delegate(CostTypeDef ctd, BuildCostStringContext ctx)
					{
						//IL_0006: 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)
						CS$<>8__locals9.baseCostType.BuildCostString(ctx.cost, ctx.stringBuilder);
					},
					getCostColor = (GetCostColorDelegate)((CostTypeDef ctd, GetCostColorContext ctx) => CS$<>8__locals9.baseCostType.GetCostColor(ctx.forWorldDisplay)),
					buildCostStringStyled = (BuildCostStringStyledDelegate)delegate(CostTypeDef ctd, BuildCostStringStyledContext ctx)
					{
						//IL_0006: 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_0012: 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)
						CS$<>8__locals9.baseCostType.BuildCostStringStyled(ctx.cost, ctx.stringBuilder, ctx.forWorldDisplay, ctx.includeColor);
					}
				};
				object obj = <>O.<0>__IsAffordable;
				if (obj == null)
				{
					IsAffordableDelegate val2 = IsAffordable;
					<>O.<0>__IsAffordable = val2;
					obj = (object)val2;
				}
				val.isAffordable = (IsAffordableDelegate)obj;
				object obj2 = <>O.<1>__PayCost;
				if (obj2 == null)
				{
					PayCostDelegate val3 = PayCost;
					<>O.<1>__PayCost = val3;
					obj2 = (object)val3;
				}
				val.payCost = (PayCostDelegate)obj2;
				CostTypeDef item = val;
				list.Add(item);
			}
		}

		[CompilerGenerated]
		private sealed class <>c__DisplayClass7_0
		{
			public CostTypeDef baseCostType;

			internal void <RegisterCostType>b__1(CostTypeDef ctd, BuildCostStringContext ctx)
			{
				//IL_0006: 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)
				baseCostType.BuildCostString(ctx.cost, ctx.stringBuilder);
			}

			internal Color32 <RegisterCostType>b__2(CostTypeDef ctd, GetCostColorContext ctx)
			{
				//IL_0006: 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)
				return baseCostType.GetCostColor(ctx.forWorldDisplay);
			}

			internal void <RegisterCostType>b__3(CostTypeDef ctd, BuildCostStringStyledContext ctx)
			{
				//IL_0006: 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_0012: 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)
				baseCostType.BuildCostStringStyled(ctx.cost, ctx.stringBuilder, ctx.forWorldDisplay, ctx.includeColor);
			}
		}

		public const string CostTypeName = "LunarItem";

		internal static PurchaseInteraction PurchaseInteraction { get; set; }

		public static void Register()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			RegisterCostType();
			object obj = <>c.<>9__5_0;
			if (obj == null)
			{
				hook_Init val = delegate(orig_Init orig)
				{
					orig.Invoke();
					ApplyCostTypeIndex();
				};
				<>c.<>9__5_0 = val;
				obj = (object)val;
			}
			CostTypeCatalog.Init += (hook_Init)obj;
		}

		private static void ApplyCostTypeIndex()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < CostTypeCatalog.costTypeCount; i++)
			{
				if (CostTypeCatalog.GetCostTypeDef((CostTypeIndex)i)?.name == "LunarItem")
				{
					PurchaseInteraction purchaseInteraction = PurchaseInteraction;
					if (purchaseInteraction != null)
					{
						purchaseInteraction.costType = (CostTypeIndex)i;
					}
					break;
				}
			}
		}

		internal static void RegisterCostType()
		{
			CostTypeCatalog.modHelper.getAdditionalEntries += delegate(List<CostTypeDef> list)
			{
				//IL_0013: 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_002a: 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_003b: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: 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_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Expected O, but got Unknown
				//IL_009b: 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_00ad: Expected O, but got Unknown
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bf: Expected O, but got Unknown
				//IL_00bf: 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_00d0: 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_00db: Expected O, but got Unknown
				//IL_0102: Expected O, but got Unknown
				//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Expected O, but got Unknown
				CostTypeDef baseCostType = CostTypeCatalog.GetCostTypeDef((CostTypeIndex)9);
				CostTypeDef val = new CostTypeDef
				{
					name = "LunarItem",
					itemTier = baseCostType.itemTier,
					colorIndex = baseCostType.colorIndex,
					costStringFormatToken = baseCostType.costStringFormatToken,
					costStringStyle = baseCostType.costStringStyle,
					saturateWorldStyledCostString = baseCostType.saturateWorldStyledCostString,
					darkenWorldStyledCostString = baseCostType.darkenWorldStyledCostString,
					buildCostString = (BuildCostStringDelegate)delegate(CostTypeDef ctd, BuildCostStringContext ctx)
					{
						//IL_0006: 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)
						baseCostType.BuildCostString(ctx.cost, ctx.stringBuilder);
					},
					getCostColor = (GetCostColorDelegate)((CostTypeDef ctd, GetCostColorContext ctx) => baseCostType.GetCostColor(ctx.forWorldDisplay)),
					buildCostStringStyled = (BuildCostStringStyledDelegate)delegate(CostTypeDef ctd, BuildCostStringStyledContext ctx)
					{
						//IL_0006: 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_0012: 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)
						baseCostType.BuildCostStringStyled(ctx.cost, ctx.stringBuilder, ctx.forWorldDisplay, ctx.includeColor);
					}
				};
				object obj = <>O.<0>__IsAffordable;
				if (obj == null)
				{
					IsAffordableDelegate val2 = IsAffordable;
					<>O.<0>__IsAffordable = val2;
					obj = (object)val2;
				}
				val.isAffordable = (IsAffordableDelegate)obj;
				object obj2 = <>O.<1>__PayCost;
				if (obj2 == null)
				{
					PayCostDelegate val3 = PayCost;
					<>O.<1>__PayCost = val3;
					obj2 = (object)val3;
				}
				val.payCost = (PayCostDelegate)obj2;
				CostTypeDef item = val;
				list.Add(item);
			};
		}

		internal static bool IsAffordable(CostTypeDef costTypeDef, IsAffordableContext context)
		{
			//IL_0000: 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_0040: Unknown result type (might be due to invalid IL or missing references)
			CharacterBody val = default(CharacterBody);
			if (((Component)context.activator).TryGetComponent<CharacterBody>(ref val))
			{
				Inventory inventory = val.inventory;
				if ((Object)(object)inventory == (Object)null || inventory.inventoryDisabled)
				{
					return false;
				}
				int cost = context.cost;
				int num = 0;
				for (int i = 0; i < ItemCatalog.lunarItemList.Count; i++)
				{
					num += inventory.GetItemCountPermanent(ItemCatalog.lunarItemList[i]);
					if (num >= cost)
					{
						return true;
					}
				}
			}
			return false;
		}

		internal static void PayCost(PayCostContext context, PayCostResults result)
		{
			Inventory activatorInventory = context.activatorInventory;
			if (!((Object)(object)activatorInventory == (Object)null))
			{
				if (!LunarScrapCompatibility.Enabled || !LunarScrapCompatibility.TryPayWithLunarScrap(activatorInventory, result))
				{
					PayWithRandomLunarItems(activatorInventory, context, result);
				}
				MultiShopCardUtils.OnNonMoneyPurchase(context);
			}
		}

		internal static void PayWithRandomLunarItems(Inventory inventory, PayCostContext context, PayCostResults result)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: 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_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Invalid comparison between Unknown and I4
			//IL_0035: 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_00c7: 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_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: 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)
			ItemIndex avoidedItemIndex = context.avoidedItemIndex;
			List<ItemIndex> list = new List<ItemIndex>();
			foreach (ItemIndex lunarItem in ItemCatalog.lunarItemList)
			{
				if (lunarItem != avoidedItemIndex)
				{
					int itemCountPermanent = inventory.GetItemCountPermanent(lunarItem);
					for (int i = 0; i < itemCountPermanent; i++)
					{
						list.Add(lunarItem);
					}
				}
			}
			if (list.Count < context.cost)
			{
				int val = context.cost - list.Count;
				int val2 = (((int)avoidedItemIndex != -1) ? inventory.GetItemCountPermanent(avoidedItemIndex) : 0);
				for (int j = 0; j < Math.Min(val, val2); j++)
				{
					list.Add(avoidedItemIndex);
				}
			}
			TryTransformResult val5 = default(TryTransformResult);
			for (int k = 0; k < context.cost; k++)
			{
				if (list.Count <= 0)
				{
					break;
				}
				int index = context.rng.RangeInt(0, list.Count);
				ItemTransformation val3 = default(ItemTransformation);
				((ItemTransformation)(ref val3)).allowWhenDisabled = true;
				((ItemTransformation)(ref val3)).forbidTempItems = true;
				((ItemTransformation)(ref val3)).minToTransform = 1;
				((ItemTransformation)(ref val3)).maxToTransform = 1;
				((ItemTransformation)(ref val3)).originalItemIndex = list[index];
				((ItemTransformation)(ref val3)).newItemIndex = (ItemIndex)(-1);
				ItemTransformation val4 = val3;
				if (((ItemTransformation)(ref val4)).TryTransform(inventory, ref val5))
				{
					result.AddTakenItemsFromTransformation(ref val5);
				}
				list.RemoveAt(index);
			}
		}
	}
	public static class LunarPrinter
	{
		public static GameObject prefab;

		public static InteractableSpawnCard spawnCard;

		public static readonly string name = "DuplicatorBlue";

		internal static readonly string _nameToken = "DUPLICATOR_BLUE";

		public static void Init()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			prefab = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/DuplicatorLarge/DuplicatorLarge.prefab").WaitForCompletion(), name, true);
			ApplyVisuals();
			ApplyInspectInfo();
			ApplyBehavior();
			ApplyPurchaseInteraction();
			LanguageAPI.Add(_nameToken + "_NAME", "Lunar Printer");
			string text = "Allows survivors to print a lunar item if they sacrifice a random lunar item.";
			LanguageAPI.Add(_nameToken + "_INSPECT_DESCRIPTION", LunarScrapCompatibility.Enabled ? LunarScrapCompatibility.InspectDescription : text);
			PrefabAPI.RegisterNetworkPrefab(prefab);
			CreateSpawnCard();
		}

		private static void ApplyVisuals()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_001e: 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_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			SkinnedMeshRenderer componentInChildren = prefab.GetComponentInChildren<SkinnedMeshRenderer>(true);
			Material val = new Material(((Renderer)componentInChildren).sharedMaterials[0]);
			Material val2 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/moon/matMoonBridge.mat").WaitForCompletion();
			Material val3 = Addressables.LoadAssetAsync<Material>((object)"RoR2/Base/Duplicator/matDuplicator.mat").WaitForCompletion();
			val.SetTexture("_MainTex", val2.GetTexture("_BlueChannelTex"));
			val.SetTexture("_GreenChannelTex", val3.GetTexture("_MainTex"));
			((Renderer)componentInChildren).sharedMaterials = (Material[])(object)new Material[1] { val };
		}

		private static void ApplyInspectInfo()
		{
			//IL_0013: 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)
			GenericInspectInfoProvider val = default(GenericInspectInfoProvider);
			if (prefab.TryGetComponent<GenericInspectInfoProvider>(ref val))
			{
				InspectDef val2 = Object.Instantiate<InspectDef>(Addressables.LoadAssetAsync<InspectDef>((object)"RoR2/Base/DuplicatorLarge/LargeDuplicatorInspectDef.asset").WaitForCompletion());
				val2.Info.TitleToken = _nameToken + "_NAME";
				val2.Info.DescriptionToken = _nameToken + "_INSPECT_DESCRIPTION";
				val.InspectInfo = val2;
			}
		}

		private static void ApplyBehavior()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			ShopTerminalBehavior val = default(ShopTerminalBehavior);
			if (prefab.TryGetComponent<ShopTerminalBehavior>(ref val))
			{
				val.dropTable = (PickupDropTable)(object)ScriptableObject.CreateInstance<LunarDropTable>();
				val.itemTier = (ItemTier)3;
			}
		}

		private static void ApplyPurchaseInteraction()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			PurchaseInteraction val = default(PurchaseInteraction);
			if (prefab.TryGetComponent<PurchaseInteraction>(ref val))
			{
				val.displayNameToken = _nameToken + "_NAME";
				val.costType = (CostTypeIndex)9;
				val.cost = 1;
				LunarItemCostType.PurchaseInteraction = val;
			}
		}

		private static void CreateSpawnCard()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			spawnCard = Object.Instantiate<InteractableSpawnCard>(Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/DuplicatorLarge/iscDuplicatorLarge.asset").WaitForCompletion());
			((Object)spawnCard).name = "iscDuplicatorBlue";
			((SpawnCard)spawnCard).prefab = prefab;
			((SpawnCard)spawnCard).directorCreditCost = LunarPrinterPlugin.CreditCost.Value;
		}

		public static void Register()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			//IL_0032: 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_003e: Expected O, but got Unknown
			Helpers.AddNewInteractable(new DirectorCardHolder
			{
				Card = new DirectorCard
				{
					spawnCard = (SpawnCard)(object)spawnCard,
					selectionWeight = LunarPrinterPlugin.SelectionWeight.Value,
					minimumStageCompletions = 0
				},
				InteractableCategory = (InteractableCategory)8
			});
			LunarItemCostType.Register();
		}
	}
}
namespace LunarPrinter.Compatibility
{
	internal static class LunarScrapCompatibility
	{
		private static bool? _enabled;

		internal static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled == true;
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("Geritos.Lunar_Scrap");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		internal static string InspectDescription => "Allows survivors to print a lunar item if they sacrifice a lunar scrap or a random lunar item. The Lunar Printer will always take scrap before a random item.";

		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static bool TryPayWithLunarScrap(Inventory inventory, PayCostResults result)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			if (inventory.GetItemCountPermanent(LunarScrapItem.LunarScrapItemDef.itemIndex) <= 0)
			{
				return false;
			}
			ItemTransformation val = default(ItemTransformation);
			((ItemTransformation)(ref val)).allowWhenDisabled = true;
			((ItemTransformation)(ref val)).forbidTempItems = true;
			((ItemTransformation)(ref val)).minToTransform = 1;
			((ItemTransformation)(ref val)).maxToTransform = 1;
			((ItemTransformation)(ref val)).originalItemIndex = LunarScrapItem.LunarScrapItemDef.itemIndex;
			((ItemTransformation)(ref val)).newItemIndex = (ItemIndex)(-1);
			ItemTransformation val2 = val;
			TryTransformResult val3 = default(TryTransformResult);
			if (((ItemTransformation)(ref val2)).TryTransform(inventory, ref val3))
			{
				result.AddTakenItemsFromTransformation(ref val3);
			}
			return true;
		}
	}
	internal static class QoLChestsCompatibility
	{
		private static bool? _enabled;

		internal static bool Enabled
		{
			get
			{
				bool valueOrDefault = _enabled == true;
				if (!_enabled.HasValue)
				{
					valueOrDefault = Chainloader.PluginInfos.ContainsKey("Faust.QoLChests");
					_enabled = valueOrDefault;
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void RegisterLunarPrinterHighlighting()
		{
			InteractableRegistry.Register(LunarPrinter.Content.LunarPrinter.name, (InteractableCategory)3);
		}
	}
}